llPushObject math of doom?
|
|
Deneb Rosewood
Registered User
Join date: 2 Feb 2006
Posts: 15
|
05-15-2006 18:35
I've studied the wiki on this as far as I can manage, but end result; I'm just not smart enough to comprehend all that, especially when I don't even understand how my prims weight relates to my AVs weight, or how to figure out how much I weigh in SL.
I've tested and fiddled with as many bullet/push scripts I could get my hands on but can't get the desired result, my guini pig eather feals nothing or flies off into the next sim, when I'm trying for a controlled bump # yards in the dirrection the prim is facing.
I need somebody to dumb this down for me, is there by any chance a mathy code that I can use to type in how many yards I want to knock llDetectedKey(0)? I didn't go to collage or anything so please keep it simple and try to use examples ^.^;
|
|
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
|
05-15-2006 18:58
Here's my related experiences:
I made an avatar launching cannon. Works great, fires an avatar about 150m on level ground at the default angle.
When I tried to tweak it to land on a particular point (by adjusting the power) I had issues. It seemed the push was quantized... as I increased it I'd get nothing, nothing, nothing, nothing, extra 200 metres. So I gave up, since it wasn't very important. *laughs*
Later I made an "orbital cannnon" that was meant to parallel puch (once per prim) my avatar as high as possible I couldn't get over 600 metres, no matter how many extra max-force pushes I used. When I tilted the cannon at an angle I went through sims so fast I had lots of wierd crashing/stopping midair issues, so I destroyed that project.
|
|
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
|
05-15-2006 21:26
I'm afraid I have to agree with Nepenthes - I spent many fruitless hours trying to use llApplyImpulse() and llApplyRotationalImpulse() in a 'self-balancing' object, to no avail. I eventually abandoned the project, my conclusion being that the current SL physics engine just isn't able to support detailed 'real world' kinematics modelling of this type, at the script-level at least.
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
05-16-2006 04:36
Hi Deneb, I have been experimenting with this myself. I still have a long way to go, but i think the secret is to use feedback. You need to call llTarget before starting and use the not_at_target() listener. There you can sense the velocity and keep on adjusting your force and impulse. The lower the velocity, the higher the applied impulse should be. float vel = llVecMag (llGetVel ());
You can use that value to adjust your next impulse applied in this listener. I have constrained my physical object (an elevator) in a metal shaft, so it cannot turn and twist too much, but you may need to adjust those properties as you go along. Good Luck with it! Ed
|
|
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
|
05-16-2006 04:47
From: Jigsaw Partridge I'm afraid I have to agree with Nepenthes - I spent many fruitless hours trying to use llApplyImpulse() and llApplyRotationalImpulse() in a 'self-balancing' object, to no avail. I eventually abandoned the project, my conclusion being that the current SL physics engine just isn't able to support detailed 'real world' kinematics modelling of this type, at the script-level at least. I have self balancing objects that hold position and orientation. The in-game physics is good enough to support this. To achieve it I used real world concepts of control engineering. The main difference is that one has to think in terms of impulse rather than force.
|
|
Jigsaw Partridge
A man of parts
Join date: 3 Apr 2005
Posts: 69
|
05-16-2006 05:07
*takes hat off*  OK, maybe I should have another go at it. I was trying to make an 'avatar' shaped object with moving legs keep its balance while walking, I got depressed when I discovered that a simple call to llRotLookAt() was doing far better than I could at keeping Mr Prim upright, even with the complex pattern of rotational and translational impulses I was applying.
|
|
Aodhan McDunnough
Gearhead
Join date: 29 Mar 2006
Posts: 1,518
|
05-16-2006 05:27
When you meant self-balancing you meant a bipedal object ... well that's a bit more difficult undertaking even in reality.
If things get too troublesome it might be better for you to just make it look like its balancing rather than have it really try to balance on two feet. Admittedly it takes a lot away from the awesomeness factor but things managed by user-made control algorithms encounter more problems when lag hits.
In my vehicle building I do try to keep my own control routines to a minimum so that there will be less effect from lag.
Good luck nonetheless and I'd like to see what comes out of your experiments, certainly sounds like a barrel of fun.
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
05-17-2006 08:39
There was an avatar hurling transport system at last year's Burning Life. It was pretty accurate. So this must be possible with the current physics engine. Does anyone remember who made the Burning Life transport system last year?
|
|
Archanox Underthorn
Registered User
Join date: 20 May 2003
Posts: 168
|
05-17-2006 09:54
Lemme post a bit of code I have for a controlled push. In my tests it pushes an object the same distance reguardless of the pushing object's mass, the target's mass or the distance between them. vector push = llRot2Fwd(llGetRot()); float basepow = 20;
//Multiply the push by the targets mass, divide by half the source's mass basepow *= llGetObjectMass(targetkey); basepow /= llGetObjectMass(llGetKey()) / 2; //code from the wiki, balances push based on distance float power = basepow*(1/(1/llPow(llVecDist(llGetPos(), targetpos), 3))); push *= power;
llPushObject(targetkey, push, <0,0,0>, FALSE); Just as a note, the basepower isnt a mesaure in m or anything, just an arbitrary number. Give it a try, lemme know how it works.
_____________________
Archatek
Home to some of the highest quality katanas and other blades available in SL. Co-creator of the Samurai Island Combat System, one of the best melee combat systems available, come check it out!
___________________
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
05-17-2006 12:55
From: BamBam Sachertorte There was an avatar hurling transport system at last year's Burning Life. It was pretty accurate. So this must be possible with the current physics engine. Does anyone remember who made the Burning Life transport system last year? Those were my design. The main deal is factoring in the mass of the object, as Archanox says, and the distance if the pushing object doesn't actually surround the pushee. Beyond that, once you have a consistent push, you need to translate that into going a consistent distance.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|