Help! rotation based on distance between initial touch X and swipe X distance from the initial touch
Hi everyone,
hoping i can get some help with this, as the title says I'm having a hard time setting up an actors rotation based on the initial touch and swipe distance from the initial touch.
i have it working to an extent but, the actors rotation, spins about on the next initial touch, basically its constrained to the magnitude between the initial touch x and the mouse position x
what i want to achieve is a rotation that increases in increments from the initial touch position. and on the next touch it doesn't jump about its rotation, but continues smoothly from its rotation again from the initial touch. hope that makes sense?
i guess i need to tell the actors to rotate based on the magnitude from the initial touch but in a way that only increases the rotation, not constraining it to the rotation of the distance via magnitude. I'm thinking i need to set up some code to tell it to ad too its rotation based on the magnitude, i just don't know how.
hope some one can help
Comments
Try something like this:
@RThurman thanks man, will give it a shot sounds like that will work
You are welcome. Hope it works for you.
Thanks for the help @RThurman but it still jumps about its rotation on initial touch, I have a temporary solution using angular volosity buts it's not perfect as it's not based on distance from initial touch and it keeps rotating anyways will upload a demo sto show what I'm getting at if anyone cares haha
Like this?
There's some old attributes in there from a project I'm working on with this in it so ignore those. You can see what's needed from the one actor in the project
https://www.dropbox.com/s/1k34figdx38kx3l/Drag To Rotate Box.zip?dl=0
Sorry I can't attach projects as my account has temporarily expired
Hmm... Here is a demo that shows one way to do it.
(I like @KevinCross's suggestion better!)
I can't take credit for it. I would have only found it here on the forums
Thank you guys so much for the help, will try these out and report back, what a great community here hey!
thanks guys, both methods work great, ill probably include them both with an option to choose so thank you
Glad they are working for you!