Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi, Was wondering how to calculate just the distance in front of the player position only (not to the side) based on the X & Z target co-ordinates & perhaps position also. I notice how both X & Z change when I move the mouse up and down depending on the direction of the player - for the target co-ordinates. This is my code so far but it puts items in front but also to the side - not always only in front: var posn = ccbGetSceneNodeProperty(player, "Position"); var targ = ccbGetSceneNodeProperty(player, "Target"); var distX = ((targ.x - posn.x) * 0.04); var distY = (targ.y - posn.y); var distZ = ((targ.z - posn.z) * 0.04); ccbSetSceneNodeProperty(clone, "Position", posn.x+distX, posn.y+distY, posn.z+distZ); |
|