#player relative velocity mesurements

1 messages · Page 1 of 1 (latest)

next burrow
#

is there a way to messure a players hand or object velocity relative to the player? if i cut to the side then it will say x but if i rotate myself it will be y, is there a way to make the velocity be relative to the player so i can mesure when a players hand pushed forward or slashes to the side

ruby flax
#

Quaternions! I always forgot the exact way to do it until i'm in-game playing with it though, hopefully someone else can elaborate on it

next burrow
#

ill mess around with them later to see if i can get something to work until someone can elaborate more, if j get it to work by then at least this post will help someone else with the same issue

#

i tried to rotate vector using the player head orientation, it worked somewhat but depending on which way im facing it caused left hand swip and right hand swip movements to change

#

basically, face forward in room, hand moves right does task A, hand moves left does task B, if i rotate myself 90 degrees task A and B swap around

#

so left swipe does A and right swipe does B

ruby flax
#

Oh if you just need it to be detecting left and right, i know what to do.
You can use vector cross on the up and forward vectors of someone's head, it outputs a vector perpendicular to the inputs (imagine you're using the up and forward vectors to mark where there is a flat plane, and the output is a vector sticking perfectly out of that plane)
Use vector dot to compare the hand velocity (normalised) against this vector, with close to 1 meaning it's right, and close to -1 meaning it's left (or the other way around, i forget what order you have to cross the up and forward vector to get what direction)

next burrow
#

awesome thank you

icy plinth
next burrow
#

thank you so much!

icy plinth
#

if so u can mark as answered

next burrow
#

yep works

icy plinth
# next burrow yep works

Good to hear! You can mark this post as answered by selecting the "three dots icon" (···), selecting "Edit Tags", and enabling the "GoldenCrab Answered" checkbox.

next burrow
#

got it