#How to make a object point at you in CV2

1 messages · Page 1 of 1 (latest)

storm wind
#

So basicaly im trying to make a handle that makes a bar appear and I want it to point at you but not up and down but left and right

rough shoal
#

Subtract the position of the player (top) and the position of the bar (bottom). This gives you a vector that is looking at the player. Vector3 Split that vector and use a Vector3 Create to connect the X to X and Z to Z (Leave the Y alone). Then just set the rotation

pseudo fossil
lusty isle
pseudo fossil
hollow snow
pseudo fossil
#

@lusty isle

lusty isle
#

I'll try and draw a quick example if someone can send an image of a top down view of an object or something

pseudo fossil
#

Oh also how would I calculate the progress with vectors my math kinda sucks

lusty isle
#

The progress itself? Use Inverse Lerp if you have A and B and current P

How to get the progress you want for this situation? You would get the Distance between your current rotation and the end rotation, then Divide 1 by that to get the reciprocal (or Power to -1), then Multiply that by your DeltaTime and RotationSpeed.

This would mean that no matter how far or close the rotations are, it will always be the same speed as its Distance is essentially cancelled out.