Hello! I got a great problem with this...Making a grabPoint i got it working, but the player is a little far from grabPoint when grab the point...
I used this to get it on the right height(same of the grabPoint):
Ok, that is working. But Playermodel is a little far from the grabPoint in the axis Z (of the player)...
Well i would do the same thing in the Z axis, but it doesn
[EDIT] I'm using this code:
Please help me!!!
Thank you Guys! =D
You need to add an offset to the player's new position.
Put a GrabPoint down somewhere, and see exactly where the player should be in relation to it to be visually correct. Then put that value into the var offset : Vector3 below:
transform.position = collision.transform.InverseTransformPoint( offset );
InversetTransformPoint takes rotation into account, so as you rotate a grabPoint, it should rotate the snap-to position properly.
If different GrabPoints can have different offsets, you may need to make offset a member of GrabPoint objects rather than a global / magic number.
answered Oct 05 '10 at 07:46 AM
you could just use localPosition instead of position for things you want in local space to an object
alternatively, you could use transform.forward to get the local forward vector of a transform
answered Jun 16 '10 at 06:02 PM