llMoveToTarget Disable Z Movment?
|
|
Ody Naglo
Registered User
Join date: 1 Apr 2008
Posts: 31
|
05-16-2009 00:01
** First Problem - Is there a way to disable up and down movment so it just falls out of the sky and follows only the X/Y ? like a normal physical prim with no script. ** Second Problem - I cant seem to keep my pet upright he sometimes flips sideways or upside down =P ------------------ Code Removed By Poster -------------------------- .
|
|
White Hyacinth
Registered User
Join date: 15 Nov 2006
Posts: 353
|
05-16-2009 11:14
As to your first problem:
Would it help to set your target to the same as the current position? Something like:
...
vector target = <anyX, anyY, anyZ>;
vector CurrentPos = llGetPos();
target.z = CurrentPos.z;
...
As to your second problem: My pet does that too! Help!
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-16-2009 14:21
first problem: your description and statement conflict... do you want the object to move up and down or not (disabling z MOVEMENT will prevent up and down)
if you want it to go only up and down then just use the z component in your target offset. target = llGetPos(); <target.x, target.y, target.z + offsetUpDown> reverse that if you want only floor style planar movement <target.x+ offsetFwdBack, target.y + offsetLeftRight, target.z>
second problem: top = llRot2Up( llGetRot() ); if (top.z < .9){ //-- we're tipping oever, fix it llSetRot( llGetRot() * llRotBetween( top, <0.0, 0.0, 1.0> ) ); //-- I think that's the right order, if not swap get rot and rot between ) }
_____________________
| | . "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... | - 
|
|
Ody Naglo
Registered User
Join date: 1 Apr 2008
Posts: 31
|
05-16-2009 15:47
From: Void Singer first problem: your description and statement conflict... do you want the object to move up and down or not (disabling z MOVEMENT will prevent up and down) if you want it to go only up and down then just use the z component in your target offset. target = llGetPos(); <target.x, target.y, target.z + offsetUpDown> reverse that if you want only floor style planar movement <target.x+ offsetFwdBack, target.y + offsetLeftRight, target.z> second problem: top = llRot2Up( llGetRot() ); if (top.z < .9){ //-- we're tipping oever, fix it llSetRot( llGetRot() * llRotBetween( top, <0.0, 0.0, 1.0> ) ); //-- I think that's the right order, if not swap get rot and rot between ) } llSetStatus(STATUS_PHYSICS, FALSE); llSetRot( llGetRot() * llRotBetween( top, <0.0, 0.0, 1.0> ) ); llSetStatus(STATUS_PHYSICS, TRUE) My object is physical llSetRot will not work. But its no big deal ill just take off the physics llsetrot then turn them back on. Also my first problem - I think I explained myself quite well but who knows - I just want it to follow the X/Y the pet is a ground dwelling creature. But if it say walks off a cliff it dosent fall it just keeps on walking around on air.
|
|
White Hyacinth
Registered User
Join date: 15 Nov 2006
Posts: 353
|
05-16-2009 17:00
Maybe we have to implement our pets as a VEHICLE?
It looks like many things have been pre-cooked for vehicles, that maybe we cannot implement in any other way?
I do like Void's idea to watch for too big a tilt and quicky switch to a RotTarget restoring the upright position only when we are about to fall over... Thanks for that Void!
|
|
Ody Naglo
Registered User
Join date: 1 Apr 2008
Posts: 31
|
05-16-2009 17:14
From: White Hyacinth Maybe we have to implement our pets as a VEHICLE? It looks like many things have been pre-cooked for vehicles, that maybe we cannot implement in any other way? I do like Void's idea to watch for too big a tilt and quicky switch to a RotTarget restoring the upright position only when we are about to fall over... Thanks for that Void! Yea that helped me alot also. Ty Void
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-16-2009 18:56
eh sorry, for physics you could use apply rotational impulse and better yet llRotTarget this is a bit of guesswork here, but should provide a basis llRotTarget( ZERO_ROTATION, PI / 8 );
not_at_rot_target( ){ vVecTop = llRot2Up( llGetRot ); if (vVecTop.z < .9){ //-- you may have to play with the multiplier here, and the true/false llApplyRotationalImpulse( <vVecTop.x, vVecTop.y, 0.0> * (1 - vVecTop.z), TRUE ); } //-- I probably royally screwed up on this part, you may need to invert the vector as 1-* llRotTarget( llEuler2Rot( <vVecTop.x, vVecTop.y, 0.0> * PI ), PI / 8 ); }
_____________________
| | . "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... | - 
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-16-2009 19:34
eh screw that... even when I got rotational impulse down to ZERO_VECTOR - <x, y, 0> it was still crap... use the physics switching.
ZERO_VECTOR - <???, ???, 0> * TWO_PI, TRUE that's as far as I could get
PS never EVER hold both ctrl and shift when grabbing a physical object.... that's applying an impulse... it's like it builds whyile you're grabbing and explodes out.
_____________________
| | . "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... | - 
|
|
Ody Naglo
Registered User
Join date: 1 Apr 2008
Posts: 31
|
05-16-2009 19:46
From: Void Singer eh screw that... even when I got rotational impulse down to ZERO_VECTOR - <x, y, 0> it was still crap... use the physics switching. yea I agree physics switching is much better =P thats why I havent really tried to use impluse for the movments from point A to B I like the smoothness of llMoveToTarget I just wish it would follow the terrain not just the ground - Prim terrain also. Maybe its wishfull thinking unless I use llStopMoveToTarget with a Delay after the pet gets to point B but that just causes the other parts of the script to lag behind. So I been looking for a way to stop llMoveToTarget.z where it only follows X/y letting .z find it own hight by falling or w/e. like a physical non-scripted prim would do if you dragged it into the air and let it go. it would just fall till something gets in its way.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-16-2009 19:56
it's nasty, but you could precheck the new position at a height above your current plane, and drop a sensor ball there to get physics height.... that'd be REALLY ugly though.
_____________________
| | . "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... | - 
|