adding force to object (demo added) new question

Posted By: Anonymous

adding force to object (demo added) new question - 05/09/03 14:43

I just got A6 and have been playing with the physics but Im having a problem. I want to add to the force of the object in the direction its going, but I cant seem to get it to go anywhere but along a fixed axis. What it needs to do is increase in speed when it hits a certain object.

Any ideas?

EDIT: Also, is there anyway to constrain the object on one axis, for example if I dont want it to move on the Y axis or z axis?
Posted By: ventilator

Re: adding force to object (demo added) new question - 05/10/03 00:21

do you use phent_addforcelocal?
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 04:38

Ventilator,

yeah thanks, I think I got it somewhat working using that, I think I just wasnt applying enough force (seems you have to really add to the force to get it to move with one hit). However, sometimes it will hit the object and not go faster, sometimes it will hit it several time in a row and jet off the screen.

Is there a way to limit the force of an object? and a way to limit it so it wont move in the Z pos and jump off the screen?
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 05:51

OK, I decided to upload a compiled demo of my physics test so anyone can try it. Its based off my pinball tutorial I did, I just wanted to apply real physics to the ball. You can can test it and see where Im having the problems.

The most obvious, which was the same in the tutorial, is that the flippers tend to move inside the ball causing it to go in wierd directions (I am using Ent_move as suggested by conitec).

Second, the ball doesnt always seem to get the same force applied to it when it hits the bumpers, sometimes it will jut bounce and other times it will take off in a flash.

Third, when you lose the ball each time it restarts (you press S to restart) it starts faster and faster.

I added some lights and sound effects to make it better to test. It plays fairly well considering the problems, though I think it could be a lot better, especially if I can fix them.

Any comments are welcome.

Physics Pinball Test Demo
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 06:51

The amount of force on an object can not be limited, but you should set its speed limits to avoid explosions. If possible don't apply one huge force for the duration of a single frame- instead apply smaller forces of the duration of a few frames.

When objects suddenly jump off it's usually due to collision detection problems (edge on edge) or by forcing the object in unnatural positions (such as ent_creating a new model inside a physics object). In case of the flippers I think the problem is that even after an impact the flippers still keep rotating. The ball has not had a chance to get moved out of the way yet the flippers keep rotating towards it and end up inside the ball. Try halting the rotation for a few frames after hitting the ball.
Posted By: ventilator

Re: adding force to object (demo added) new question - 05/10/03 07:11

quote:
...but you should set its speed limits to avoid explosions.
how can i set speed limits?
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 07:46

that helped a little bit. The collision with the flipper is still horrible. I even tried making them passable for a short time and then decreasing the angle so they didnt go into the ball, I even tried slowing them down to pan += 1, but no matter what I do I cant get anything close to realistic action on them. I thought maybe the physics engine would make this a lot easier, but its turning out to be just as hard to code a realistic pinball game.
Posted By: ventilator

Re: adding force to object (demo added) new question - 05/10/03 07:55

i guess the flippers will behave better with the new collision system which comes with the next update. currently non physics entities still use a bounding box which doesn't rotate with the entity. this isn't very suited for flippers.

btw. marco if i try to retrieve the physics bounding vertices with phent_getbounds the position of these vertices doesn't seem to update when the entity moves. could this be a bug?
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 08:10

quote:
Originally posted by ventilator:
how can i set speed limits?

With the function phent_setmaxspeed which has not found its way into the manual [Frown]

quote:

phent_setmaxspeed(entity, var maxLinear, var maxAngular);

If an object moves faster than the specified limit it will be stopped (its velocity gets set to 0).
If an object rotates with an angular speed faster than the specified maxAngular limit, it will stop spinning (angular velocity will be reset to 0).

By default objects have no speed limit assigned to them, which can lead to problems of an object leaving the level or showing other unintended behavior. Setmaxspeed acts as a safety net to reduce this problem by halting an object if it goes beyond the specified speed limits. Because it will be halted abruptly, do not use this command for slowing down an object, for that purpose use phent_setdamping / phent_addforce instead.


Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 08:16

guess Ill have to wait for the next update to see if that helps. Ill try something else for now...
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 09:39

new question...

Now Im trying to apply force in the direction the camera is facing, but it seems no matter what I use it only goes up in the air. I even tried just setting the X or Y and it still goes in the same direction (using both centralforce and global)...
Posted By: Anonymous

Re: adding force to object (demo added) new question - 05/10/03 11:26

OK, I think I figured it out, now I just have to play with the setting to see if I can get them to do what I want....
© 2024 lite-C Forums