So here’s a mechanic I really want to implement but lack the trigonometry knowledge to complete.
Basically I want to make a platform that when you hit one side of it you stick to it (easy enough, right…) Well, one thing I made earlier is that when you click on a platform it rotates 45 degrees. So I want to make it so when your stuck to the platform and you rotate it you move with it and stay in the same position relative the platform.
Turns out this is REALLY hard. I tried just brute forcing it and that just barely worked (sometimes) and even then just barely. I’m moderately sure theres a way to do this using trigonometry, but I did some looking but couldn’t figure it out.
I want to make this mechanic but also I though it was a really cool challenge that I’m sure some other experienced developer might enjoy.
Go to test chamber at look for the sticky bundle in the ships behaviors. You can also see my attempt, I got confused somewhere around converting to radians.
@“my_name (<_>)” do you have indie, because I have a way but it would require a lot of different objects.
@seamothmaster45 yes I have indie, whats your plan??? I am rather curious.
you could use invisible blocks, destroyers and messages to move the character
and emitters! don’t forget emitters!
I don’t think that will do exactly what I want but I defiantly want to see were your thought process is going for this one. if you works though ill be very much impressed
Im not on my computer so I cant look at it, but what you could do is go into the player(whatever your controlling) then when you collision with the platform you turn off a switch for your controls, so you cant move off it. Then you turn on a switch to extract the position of the platform and use that extraction and put that into the position of you player.
I’ve got a way, that requires no extra sprites. It needs refinement, so I’ll get back to you shortly once the concept is put into action.
You could maybe do it by changing the settings of the new Material block to change friction, bounce and Density to 100, 0, 100 and acceleration always to the platform.
Also Moving the platform while its set to not movable will let it move only when the object wants to move. Moving a not movable object is called “Kinematic” and you can see more use in Kinematic in my Kinematic examples: https://flowlab.io/game/play/1268842
Edit: I just added to the Kinematic example for rotating kinematic objects!
That isn’t exactly what I was going for but it might just work!
The tricky thing is in my game you the platforms don’t cleanly rotate, but I might be able to mess with the games logic a bit and make it work.
This is fairly simple. Use the extractor of X and Y and add 32 to both of them, then send that signal through messages to the block you want to stick to. Next, the main block can have it’s rotation extracted, where instead of using A.I. Mechanics like in my Galaxy Trek game, that information is also fed into the second block. That way, they have the same velocity, rotation, and with a few adjustments, you could make a ragdoll code.
@meburningslime I’m not sure I understand, could you make a demo or re-explain please?
@“JR 01” I tried what you said, it didn’t work because I need it to stick to the bar when it rotates away from the ship, so I need it to “catch up” to the bar.
The block you want to attach extracts the position of the second block. It then adds 32 pixels, which is one block. After this, you submit the two coordinates you just found into a position block. If you want it to turn facing the same direction as the second block as well, then however you turn the second block should also send a message into the first block telling it to turn the same way.
Or, you know, you could use an “attach” block.
@meburningslime Thats not quite what I was talking about. But I’m thinking that there probably isn’t a easy way to do this. But thanks everyone who tried to help!
@“my_name (<_>)” i can make an example
No, I understand what your talking about, its just not quite what I am trying to do (refer to above, I didn’t do a great job at explaining it,) I’m pretty sure mine requires trigonometry.
Do you want the piece to rotate with the main item?
sort off, I want something to move on the edge of a rotating item.
Yes, that is what I mean.
That takes some more complex math, but nothing beyond a good Algebra 2 and exponents.
Have the alignment change the positioning.
It would be simpler math, but by no means easier to script. That would take me a half hour to make the most basic 36-degree round.
Can you actually? I’m not unreasonably bad at math but I’m also kinda dum, if you can that would be ridiculously incredible