3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Physics Engine doesn't disengage??
[Re: fastlane69]
#19165
02/25/04 12:16
02/25/04 12:16
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
Maybe you have an older version with different behavior. To double-check just write something like Code:
phent_settype(my, PH_RIGID, PH_SPHERE); phent_addcentralforce(my,...); wait(50); phent_settype(my, 0,0); wait(50); phent_settype(my, PH_RIGID, PH_SPHERE);
And see if it still moves.
|
|
|
Re: Physics Engine doesn't disengage??
[Re: fastlane69]
#19167
02/26/04 02:08
02/26/04 02:08
|
Joined: Nov 2003
Posts: 19
iprogramgames
Newbie
|
Newbie
Joined: Nov 2003
Posts: 19
|
Okay, what you wrote here was fine. I'm trying to do this:
phent_enable(me,0); temp.x = cos(my.pan) * force; temp.y = sin(my.pan) * force; temp.z = 0; phent_enable(me,1); phent_addcentralforce(you,temp);
Now, it seems to work SOMETIMES. But other times it simply won't unless written like this:
wait(1); phent_settype(me, 0, 0); temp.x = cos(my.pan) * force; temp.y = sin(my.pan) * force; temp.z = 0; phent_settype(me, PH_RIGID, PH_SPHERE); phent_addcentralforce(you,temp);
I'd rather not have to totally unregister and reregister as the collison box causes me to crash if I'm touching the entity when it is registered again. Doing this through phent_enable does not cause a crash.
One last observation. If my collision is set to PH_POLY I don't crash as much with the "register/unregister" method.
Newbie... yeah, right.
|
|
|
Re: Physics Engine doesn't disengage??
[Re: iprogramgames]
#19168
02/26/04 02:11
02/26/04 02:11
|
Joined: Nov 2003
Posts: 19
iprogramgames
Newbie
|
Newbie
Joined: Nov 2003
Posts: 19
|
Please read my above comments as well but I'm trying to make sure that you know the problem is with phent_enable NOT phent_settype.
phent_enable carries the values over. I just checked it.
Newbie... yeah, right.
|
|
|
Re: Physics Engine doesn't disengage??
[Re: iprogramgames]
#19169
02/27/04 11:48
02/27/04 11:48
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
Quote:
phent_enable(me,0); temp.x = cos(my.pan) * force; temp.y = sin(my.pan) * force; temp.z = 0; phent_enable(me,1); phent_addcentralforce(you,temp); Now, it seems to work SOMETIMES. But other times it simply won't unless written like this:
The above code retains the object's velocity past the phent_enable() calls. A disabled entity is excluded from having its position or velocity change over time. It is not unregistered or reset by that call.
Quote:
wait(1); phent_settype(me, 0, 0); temp.x = cos(my.pan) * force; temp.y = sin(my.pan) * force; temp.z = 0; phent_settype(me, PH_RIGID, PH_SPHERE); phent_addcentralforce(you,temp);
In this example you can think of the first me and the second me (or you due to the typo) as being 2 separate objects that have nothing to do with each other. What do you want to achieve? If it's just setting the velocity to 0 you could call phent_setmaxspeed(me,0,0) and wait one time unit (== 1.0/PH_FPS_MAX_LOCK)
|
|
|
Re: Physics Engine doesn't disengage??
[Re: Marco_Grubert]
#19170
02/27/04 13:41
02/27/04 13:41
|
Joined: Nov 2003
Posts: 19
iprogramgames
Newbie
|
Newbie
Joined: Nov 2003
Posts: 19
|
Yes, I'm sorry. It was a typo. Here is an explination of my exact situation. I have a space vehicle and a ball. The vehicle touches the ball and disables the physics on the ball using phent_enable because I move the ball around with the vehicle using ent_move. While the vehicle (in this case the player) is flying around with the ball the player may fire the ball. When the player fires the ball I re-enable the ball by using phent_enable and something like the following code to "fire" the ball in the proper direction in relation to the player:
var force[3];
force = 100000;
me = pPlayer; you = pBall;
phent_enable(you,1); temp.x = cos(my.pan) * force; temp.y = sin(my.pan) * force; temp.z = 0;
phent_addcentralforce(you,temp);
I have noticed that the lower the force variable is set, the less accurate the results. I'm looking for speed as firing can be instant and waiting allows the player to bump back into the ball never releasing it. I've tried your phent_setmaxspeed suggestion and it stops the entity but still doesn't solve the problem. I'd like to be able to manually set the velocities to zero as opposed to waiting until a limit is reached. This way when the player picks up the ball I could set the velocities to zero and change them accuratly during the firing function.
Newbie... yeah, right.
|
|
|
Re: Physics Engine doesn't disengage??
[Re: Marco_Grubert]
#19171
02/27/04 14:03
02/27/04 14:03
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
OP
Senior Expert
|
OP
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
Quote:
phent_enable(me,0);
temp.x = cos(my.pan) * force;
temp.y = sin(my.pan) * force;
temp.z = 0;
phent_enable(me,1);
phent_addcentralforce(you,temp);
Now, it seems to work SOMETIMES. But other times it simply won't unless written like this:
--------------------------------------------------------------------------------
The above code retains the object's velocity past the phent_enable() calls. A disabled entity is excluded from having its position or velocity change over time. It is not unregistered or reset by that call.
First off, YES!!!! Finally recognition that I"m NOT nuts!!!
Secondly, just to make sure, this is expected behaiviour and not a bug?
If its not a bug, then what I takeaway from this is:
1)phent_enable is a PE pause button; it's still "engaged" to the PE (as per your "doesn't change velocity..." statement) while I can use phent_settype calls to actually disengage the engine and thus reset my entity.
2)Even within phent_enable, I can use the velocity govenor (phent_setmaxspeed()) as a way to trick my PE into setting my velocity to 0. This is sneaky...hadn't thought of it..
Finally, this could mean something, Ipro i'm doing the EXACT SAME THING....I'm disengagin my PE so I can move my ball around and then reengaging only when the player Throws the ball!!!!
|
|
|
Re: Physics Engine doesn't disengage??
[Re: fastlane69]
#19172
02/28/04 02:24
02/28/04 02:24
|
Joined: Nov 2003
Posts: 19
iprogramgames
Newbie
|
Newbie
Joined: Nov 2003
Posts: 19
|
I almost missed what Marco_Grubert said and it confirms the phent_enable behavior. Here's what he wrote above: Quote:
A disabled entity is excluded from having its position or velocity change over time. It is not unregistered or reset by that call.
I believe a new function to change the velocity while an entity is disabled would be nice as phent_settype is slow and will crash if the collision sphere of my physics ball is turned on while it is touching the player ship.
Newbie... yeah, right.
|
|
|
|