Problem with A 6 physics

Posted By: Mondivirtuali

Problem with A 6 physics - 07/17/07 15:39

Q: What does "1 physics object" in A6 Commercial mean ?

A: You can have multiple objects with physcis, but only one can be active at any time. So you could have a door that uses physics, and a barrel that also uses them. When the player is close to the door, the door's physics are enabled. When the player is further away from the door, its physics are turned off. When the player gets close to the barrel, the barrel's physics are turned on and then when the player is out of sight, the physics are turned off.

now, I try to assign the same action to 2 objects, not close each other .
When I run the test map, I give this alert:

and then , the white ball does't move or reacts, while the orange one works and I can push it walking against.
the 2 balls are distant .

See the video
http://www.youtube.com/watch?v=PJuLZ1kVhrY
I wonder if there is need some code to deactivate or activate the P subsystem.
This is the code
Code:
  action phys_obj
{var earthgravity[3] = 0,0, -386;


ph_setgravity(earthgravity);
phent_settype(my,PH_RIGID,ph_sphere);
phent_setmass(my,1,ph_sphere);
phent_setfriction(my,30);
phent_setelasticity(my,50,10);
phent_setdamping(my,90,90);
};
}


Posted By: D3D

Re: Problem with A 6 physics - 07/17/07 16:05

Maybe it need a trigger event. Did it worked when you applied it to only one object?
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/17/07 16:33

Yes, the orange ball works ; any other objects do not.
I trought that the engine should switch around the P properties , automatically, based on the mere distance .

Another thing: the same code with the A7 demo don't works; I get no alert message but all the objects are inamovible.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/18/07 16:12

Please help..
Posted By: fastlane69

Re: Problem with A 6 physics - 07/18/07 18:58

The 1 entity restriction means that you can have only 1 object registered in the PE.

Hence when you assign that action to two objects, you register the first object created (and hence it works) but the second object isn't registered; hence when the 2nd objects actions run, it runs into those problems.

What you have to do is deactivate one object and activate another so that only 1 object is physical at a time. When an object is NOT registered, be careful not to run any PE commands (like set-type or phent_ commands).

The distance between the objects BTW is irrelevant. As far as the game enging is concerned, there are 2 objects trying to access PE commands and hence one has to fail.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/18/07 20:43

How to deactivate the first entity? I should to create the P entity when I come closer.
I assigned one acton to this box, changing only the ph-boxCode:

action phys_obj
{var earthgravity[3] = 0,0, -386;


ph_setgravity(earthgravity);
phent_settype(my,PH_RIGID,ph_box);
phent_setmass(my,1,ph_box);
phent_setfriction(my,30);
phent_setelasticity(my,50,10);
phent_setdamping(my,90,90);
};
}


with one only entity
this time the box is passable and I stuck into it .




I still think that 3dgs need some templates for P only, some basic actions.
Is not easy as the other functions, needs a template .
Posted By: fastlane69

Re: Problem with A 6 physics - 07/18/07 20:47

I don't mean this to come off as insulting considering I have a PhD in Physics, but honestly using the PE is quite simple. Register the object, apply a force, watch it go!

The problem is that you are trying to workaround the 1 object commercial limitation; hence all of your problems have to do with the workaround and NOT the PE.

Conitec will not make a template to accomodate this workaround since a) it would defeat the purpose of the limit, b) they aren't working on A6 anymore, and c) unlimited physics is standard in all versions of A7 anyways!

So my advice to you is upgrade to A7 and use the PE without any work arounds. But if you stay with A6, not that un-registering an object is merely a null set_type call.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/18/07 21:07

I tryed the same code on A7 (now the ph is the only purpose to me to upgrade) but it don't work. One or more objects does no matter; every objects is quite immobile or do not react when I come closer.

The damn orange ball in A6 was the only ph thing that I was able to get.
Posted By: fastlane69

Re: Problem with A 6 physics - 07/18/07 21:51

I can see a few things from your code:

1) Set gravity outside of action. It should be set once and not have to rely on entity creation (and it's action) to do it.

2) you have damping set at 90... this means your objects will be so damped, they won't move unless you apply a force EVERY frame. Drop that value a bit.

3) We have no idea how you apply the force. This is a big part of the problem and solution.

Don't know that the above will solve the problem, but it's all I can see that might be wrong from what you posted.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/18/07 22:46

This is the new box code
var earthgravity[3] = 0,0, -386;

action phys_obj
{


ph_setgravity(earthgravity);
phent_settype(my,PH_RIGID,ph_box);
phent_setmass(my,3,ph_box);
phent_setfriction(my,30);
phent_setelasticity(my,50,10);
phent_setdamping(my,20,20);
};


risult: the box don't movie or is passable, if I walk agaist him, it does not movie or I remain stock into it.
I need a template for some basic use of the P engine.

edit: with the polygon option checked the code (one box) does work
Posted By: fastlane69

Re: Problem with A 6 physics - 07/19/07 00:26

Quote:

if I walk agaist him, it does not movie or I remain stock into it.





Are you using c_move to walk? Because c_moving into a physics object will not result in the physics object moving anymore than a physics object colliding into a c_moving entity will disturb it.

Oh, and take the ph_setgravity out of the action. This is what I was saying should not be in there.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/19/07 00:42

Mmmmmm
I simply checked the polygon otpion on the object property box.

Code:
   
var earthgravity[3] = 0,0, -386;

action phys_obj
{


ph_setgravity(earthgravity);
phent_settype(my,PH_RIGID,ph_box);
phent_setmass(my,3,ph_box);
phent_setfriction(my,30);
phent_setelasticity(my,50,10);
phent_setdamping(my,20,20);
};
action phys_obj1
{


ph_setgravity(earthgravity);
phent_settype(my,PH_RIGID,ph_ball);
phent_setmass(my,3,ph_ball);
phent_setfriction(my,20);
phent_setelasticity(my,60,10);
phent_setdamping(my,20,20);


};
whats wrong about the set gravity?


And it worked (we are talking , this time, about the A7 Demo)
I set 2 actions: boxe and balls and put it a lot of boxes and balls and them worked! I can walk into them and things move!
Plus , I added an enemy also. I am planning to update my edition , after all.
Quote:

Are you using c_move to walk?



The p biped , I now using only the templates.
Posted By: fastlane69

Re: Problem with A 6 physics - 07/19/07 02:09

I have no idea why checking polygon box would "fix" anything but then again that is why I don't use A7 yet... too many uncertainties!


Quote:

whats wrong about the set gravity?




You are resetting the gravity with each new entity that starts their action. It's just pointless is all. Do one ph_setgravity at the start of the simulation and that's that... remember that gravity is universal and thus having them in the action WILL NOT assign an individual gravity to each object (if that was your intent).


Quote:

The p biped , I now using only the templates.




Remember that c_move and the PE don't play together. Thus if you run into a physics object with a c_move biped, the physics object will not react to the collision. And if a physics object bumps into a c_move object, the c_move object will likewise not react. In order to have them interact you'll have to go in and program the interaction through the event handler.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/19/07 13:40

I simply checked in this way


and it works, at least I can run into the obs and they move.
One in A6 and many of them in the A7 (demo).
Posted By: fastlane69

Re: Problem with A 6 physics - 07/19/07 16:31

So you are c_moving into a physical object and that physical object responds?
Hmmmm... that is more unexpected than your solution to the problem!
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/19/07 20:28

I set as polygon every object and and an test model
the P. does work but, without the proper settings , the behavior of the obs. is really weird.
The opponent is ...well, less strong than me , he remain stucked but can still trohow away the boxes.
The final effect is not that good ; looks like the opponent does have an invisible force field around him.

watch video
http://www.youtube.com/watch?v=wdTx5Fe4B_c
I 'd like to shoot at the obs, too ; hope that some one will write a function for this, perhaps appling a force into the ob. in the direction of the shoot, like Doom 3.
Posted By: danielo999

Re: Problem with A 6 physics - 07/20/07 12:52

Quote:

I set as polygon every object and and an test model
the P. does work but, without the proper settings , the behavior of the obs. is really weird.
The opponent is ...well, less strong than me , he remain stucked but can still trohow away the boxes.
The final effect is not that good ; looks like the opponent does have an invisible force field around him.

watch video
http://www.youtube.com/watch?v=wdTx5Fe4B_c
I 'd like to shoot at the obs, too ; hope that some one will write a function for this, perhaps appling a force into the ob. in the direction of the shoot, like Doom 3.




yeah i would need such a script too
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/20/07 16:04

Update: the rocket launcher can make move the P objects!!!! The other weapons can not..the boxes and the balls react a little when I shoot them with a rocket laucher , I'd like to move them also with the other weapons and make them spread across the map, if I bombed them.
Perhaps with the proper settings..
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/20/07 20:26

update
I wrote a mini function for ph_poly. The model howewer falls in the ground and sink ..the model is setted to polygon .
The rocket launcher may move the obs.
I'd like to move them also using the other weapons. I just have to discover as the whole thing works.

watch video
http://www.youtube.com/watch?v=JgDuGrE_Vzw
Posted By: JibbSmart

Re: Problem with A 6 physics - 07/22/07 03:25

u generally want to use convex polygonal hulls with PH_POLY. the way the physics engine works: objects intersect/touch each other and are pushed away so that they are only just touching, then whatever other forces are applied. the weird shape of the c_babe gives it trouble figuring out which way to move to fix the intersection.

the best way to solve this is to have an invisible model that represents that shape MOSTLY but keeping convex.

i suppose when you c_move into physics objects, the built in collision detection doesn't allow non-physics entities to hit physics entities (as the manual clearly points out), but then when the physics engine handles the physics-enabled entities it is moved to prevent the intersection. no forces are applied to it though.

the way it works: non-physics entities cannot hit physics entities, but physics entities can hit non-physics entities.

all your examples show:
Code:
};

at the end of your actions. the semi-colon afterwards is unnecessary, and i recommend you don't do it at all because if you ever move on to lite-C (most people will eventually, and it only takes about a day to work it out because it's basically the same) the compiler is more strict and will show up an error.

if you want a physics entity to react when being shot, you should enable events on the physics entities, and get them to apply a force to themselves when they "collide" with a bullet entity. if you do this, you should also get them to change a skill in the bullet/rocket entity to notify it that it has hit something and should destroy itself, because otherwise bullets and rockets will continue to travel through physics entities until they hit a wall or something.

this is still an ugly solution because the bullets move so fast, they often won't ever intersect a physics entity (that's why you only see slight movement). you should use c_trace instead with the bullets if you want to continue using physics entities.

hope this helps,

julz
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/22/07 14:42

Thanks for the reply
there is a problem : now I am use only the templates (planning for the Intensex) and I could not (right now) write a personal code for the bullets.
A modification of the weapon template and addictional code for the P. entities?
mmmmmmm I should be an advance user, for now I am a noob, with little time .
I need a P complete template badly, I guess.


what if I changed the weapon template in work directory only using c-trace?
Posted By: JibbSmart

Re: Problem with A 6 physics - 07/22/07 21:54

i've never used templates, so i have no idea how they do whatever they do. your best bet is to probably ask a similar question in the templates forum or try to write your own alternative with questions in the C-script forum.

maybe if you're lucky someone who's template savvy may come here

julz
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/23/07 13:30

You are probably right but ...write all the proper function by myself, right now , could a waste or time. Perhaps later..doing the c-script tutorials before
Posted By: xXxGuitar511

Re: Problem with A 6 physics - 07/23/07 23:03

You'd have to edit the templates, so that after they found a collision, to test if it were a physics object, and if so, apply a force...
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/23/07 23:32

A copy of the templates in the work directory, do you mean ?
mmmmmmmmm sound not easy, let see ..
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/24/07 00:09

Quote:

i've never used templates, so i have no idea how they do whatever they do. your best bet is to probably ask a similar question in the templates forum or try to write your own alternative with questions in the C-script forum.

maybe if you're lucky someone who's template savvy may come here

julz



Well right now I have not time to learning the script language so well to write all the functions of my own, perhas the next year.
Posted By: fastlane69

Re: Problem with A 6 physics - 07/27/07 16:58

Just a quick reality check: If you want to do physics, you HAVE to learn scripting. Even template physics requires a lot of tweaks that have nothing to do with the engine and everything to do with your game.

Remember that templates are for cookie cutter games. If your game goes even slightly outside the mold, then you will be fighting the templates to do something they weren't designed for. Hence I recommend that if you wish to continue doing physics, you learn scripting first... trust me in the time it has taken you to problem solve this, you could make good headway into scripting... not saying that would have solved your problem but it may have made it easier on you.
Posted By: Mondivirtuali

Re: Problem with A 6 physics - 07/27/07 22:08

I like this definition
"cookie cutter games"
I will learn ..over time but doing all the code byself could required too much time.
© 2024 lite-C Forums