at_target Probs. Please help
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-10-2006 13:25
When i tell my object to reset to its 'default' position, it gets to its target, slows down considerably the moment it hits it, and then continues to 'drift' past the target. Here's the relevant code: Reset() { llOwnerSay("resetting."); target = llTarget(<134.5, 24.050, 502.5>, 0.2); llMoveToTarget(<134.5, 24.050, 502.5>, 0.2); } .........listening event........
at_target(integer number, vector targetpos, vector ourpos) { llOwnerSay("Reset Complete."); //llApplyImpulse(-llGetMass() * llGetVel(), FALSE); llStopMoveToTarget(); llTargetRemove(target); //llApplyImpulse(-llGetMass() * llGetVel(), FALSE); }
the commented out impulses were my attempt to balance the drift by applying opposite force, which didn't work... Pretty confused as to whats going on.
|
Davan Camus
Registered User
Join date: 13 Sep 2005
Posts: 67
|
01-10-2006 15:23
Hmm...
When you llStopMoveToTarget(), the object is no longer held in place. At that point, it should fall, due to gravity.
If you've set the buoyancy up, then it will indeed keep drifting by whatever small velocity it was last moving with.
Two things you might try are: (1) Just leave the llMoveToTarget() in effect, to keep it (generally) in place (2) Turn off physical and do an llSetPos() for the last little distance.
Hope that helps!
_____________________
Visit Cubes at Alice 100,18. -------------------------------------------------- Davan Camus, born: 2005 September 8 Out-world location: Santa Cruz, CA UI Proposal: http://davancamus.hexaflexagon.com/blog/?p=39
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-10-2006 15:54
I couldn't ask for a more perfect answer, thank you.
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-10-2006 17:01
I can't get this rotation correct. I'm trying to turn an object so it goes 90 degrees counter-clockwise, and realistically. It's physical andthe code right now makes it spin crazily. Corner() { llOwnerSay((string)push.x + " " + (string)rot); llApplyRotationalImpulse(<0,0,20>, TRUE); //} }
in its present state the OwnerSay gives back Red: 45.295345 90.000000 a couple times (i can't see how many or i'll lose the object due to its wildly spinning out of control). push.x is defined earlier on as a single impulse (buyouncy is TRUE). Help me?
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-10-2006 17:49
A rotational impulse is like starting to spin a top. What stops it? You'd have to set a rotation target, detect when you hit it, and applly a reverse rotational impulse to stop the spin.
Try a look-at or rot-look-at instead - you can do a damped rotation that way, same as move to target, except it's a rotation instead of a displacement.
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-11-2006 14:32
i've tried a gazilliion things. could someone give me an example script that moves an object forward, then turns it 90degrees to the left, and then continues on its new path (an L like path), or explain a little further? Because i understand the concept of doing it, it's just that i can't apply it properly. I tend to learn better through example, anyways.
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-11-2006 16:56
Please?
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
01-12-2006 11:37
I'll try and find you in-game tonight. The only way I can write rotation code is to try it, and go "Oops, that turned the wrong way" and then fix it. I don't think I'll ever understand it 
|
BronYAurStomp Lightworker
Beep Boop Boop Bop
Join date: 11 Dec 2005
Posts: 25
|
01-12-2006 12:43
Ok. Can anyone else help me out as well?
|