|
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
05-15-2009 05:47
I seems to be having a brain f*rt and can't think of the right command for this. I have seed pod that falls to the ground as a physical object so how or lands is somewhat random. The pod then spits seeds producing a nice effect if they shoot upwards. Problem is that sometimes the pod orientation shoots then into the ground. What is the rotation needed to have the pod reorient itself after it has fallen and changed back to non-physical so the seeds always shoot upwards?
Thanks so much.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-15-2009 07:45
If it is a particle effect, you want the z-axis pointed upward. ZERO_ROTATION works for that, as well as any rotation that is purely about the z-axis.
If you are rezzing seed objects then you should be able to do it at any rotation. Just change the position and velocity of the rezzed objects.
|
|
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
05-15-2009 08:01
The seeds are a collection of items stored in the pod inventory. Would I use GetRot or GetPos in order to get the pods orientation and then does a change in orientation work relative to the position that the pod has (which is random) or is it an absolute to the World? Let me use a square to explain, I rez a physical cube and the upper face is blue, I lift the cube and drop it. I bounces and ends up with the blue face now facing the ground, how do I rotate that so no matter which way the blue side is facing it rotates back to the top? The square changes from physical to non physical after it lands.
Thanks
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-15-2009 10:45
for rezzed object you can just use a static rez offset like <0.0, 0.0, 0.1>
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-15-2009 11:21
Yeah, as Void says it's really not important which way the rezzing prim or object is facing if you are using llRezObject() or llRezAtRoot(). But if you really do want to rotate the seed so its, "top face is up" (the blue face in your example), you should be able to compute a global rotation for that with logic something like: rotation getRotationWithTopUp() { rotation currRot = llGetRot(); vector localZ = llRot2Up(localZ); return currRot*llRotBetween(localZ, <0.0, 0.0, 1.0>); }
The result of that function would be a rotation suitable for--for example--using with llSetRot() (provided this is being done from the root prim). For example, here is a small test script that should work for your cube rotation getRotationWithTopUp() { rotation currRot = llGetRot(); vector localZ = llRot2Up(currRot); return currRot*llRotBetween(localZ, <0.0, 0.0, 1.0>); }
default { touch_start(integer nDetected) { rotation newRot = getRotationWithTopUp(); llSetRot(newRot); } }
|
|
Wyatt Weatherwax
Registered User
Join date: 23 Oct 2007
Posts: 59
|
05-15-2009 11:55
Thanks for the test script, much appreciated, I will test it tonight.
Cool, that works pretty good, now I'll work it into the whole scripted object. Thanks
|