|
Plastic Spoonhammer
Registered User
Join date: 9 Feb 2006
Posts: 20
|
02-09-2008 08:59
Hey folks, I apologize if this question comes up a lot (seems like it would), but I couldn't find it previously posted. I'm trying to get a physical object moving at a relatively constant velocity with llApplyImpulse. When I do this, the server tracks the object's movement but the object's position is not updated on the client side for some time, typically not until the object collides with something. Here's an sample script: integer moving = FALSE;
default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE); llSetForce(llGetMass()*<0,0,9.8>, FALSE); }
touch_start(integer num) { if (!moving) { moving = TRUE; llStopMoveToTarget(); llApplyImpulse(llGetMass()*<0,0.3,0>, FALSE); llOwnerSay("moving"); } else { moving = FALSE; llMoveToTarget(llGetPos(), 0.3); llOwnerSay("not moving"); } }
On initial touch, nothing appears to happen. The object does not appear to move on the client. When the object collides with something (or you 'guess right' when clicking where the object 'should' be) it's position on the client is abruptly updated. What gives? If, when the object is not moving, I walk into it, the position is updated smoothly. I would think that my bumping into the object would be implemented on the server essentially the same as llApplyImpulse()? Thanks, -Plastic Spoonhammer P.S. Is there a tag I can use to preserve indenting when posting code? *EDIT* Thanks for the tips! Code listing is all better.
|
|
Plastic Spoonhammer
Registered User
Join date: 9 Feb 2006
Posts: 20
|
02-09-2008 09:11
Well, I find that I can hack around the problem. With a timer regularly applying negligible (but non-zero!) impulses, the object's position is smoothly updated. What a bother! Anyone have some insight here? Is there a better way?
-Plastic Spoonhammer
_____________________
P. Spoonhammer
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-09-2008 11:22
What does it look like on Havok 4?
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-09-2008 13:01
have you tried llSetForce instead?
_____________________
| | . "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... | - 
|
|
Plastic Spoonhammer
Registered User
Join date: 9 Feb 2006
Posts: 20
|
02-09-2008 13:17
From: Void Singer have you tried llSetForce instead? You mean set a force for a brief interval, and turn it off with a timer? No, I haven't. I resorted to llMoveToTarget for now, which doesn't really give the effect I wanted but it's the most reliable thing I've tried. For what it's worth, I've also moved to a desolate sandbox sim off the beaten path, and that has helped. On another note, I get the same sort of problem in reverse when turning off physics with llSetStatus while the prim still has non-zero velocity. On my client, it keeps moving. Once I select it, the prim snaps to its correct position. -Plastic Spoonhammer
_____________________
P. Spoonhammer
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-09-2008 13:47
and because I forgot, using php tags will preserve indentation for those of us that have the firefox addon referenced in my sig. (works for opera also I'm told)
if you go into user cp and change your editing mode down to the basic level you'll also see proper indents when quoting a post (just not viewing), whether you have the addon or not.
_____________________
| | . "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... | - 
|