Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
12-26-2009 04:28
Hi.
I need to know what rotation I would need to make an object face another object.
What Math would I do to work out how much to Rotate Object B so it's looking at Object A.
Essentially the calculation the llLookAt function does.
I have both objects position and rotation, but I'm not sure what equasion would do this?
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
12-26-2009 06:41
From: Nyx Alsop Hi.
I need to know what rotation I would need to make an object face another object.
What Math would I do to work out how much to Rotate Object B so it's looking at Object A.
Essentially the calculation the llLookAt function does.
I have both objects position and rotation, but I'm not sure what equasion would do this? vector lookat; // coordinates of point to look at default { state_entry() { llSetRot( llRotBetween( < 1.0, 0.0, 0.0 >, llVecNorm(lookat-llGetPos()))); }
moving_end() { // refresh after move llSetRot( llRotBetween( < 1.0, 0.0, 0.0 >, llVecNorm(lookat-llGetPos()))); } }
This will point the X-axis use < 0.0, 1.0, 0.0 > for the Y-axis use < 0.0, 0.0, 1.0 > for the Z-axis
_____________________
From Studio Dora
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
12-26-2009 06:44
Oo theres a function that does it all  yay thanks.
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
12-26-2009 11:14
There's more too, look up llRotLookAt()
|
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
|
12-26-2009 14:52
That doesn't return a value tho.
|