2 registered members (AndrewAMD, bigsmack),
1,581
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Get_Mass?
#99887
11/25/06 19:27
11/25/06 19:27
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Is there some way to return the mass value of a ph object? Say during a collision?
temp = PhGet_Mass(you);
something like that? Cheers for any suggestions
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99888
11/26/06 15:52
11/26/06 15:52
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Just to update this:
I am trying to test collisions on objects and determine if ObjectA hitting ObjectB has enough velocity and mass to cause damage to the object.
In other words is Object A moving fast enough with enough mass to break the object?
I can retrieve velocity, but not the mass?
Thanks for any help
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99889
11/26/06 16:18
11/26/06 16:18
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
You could save the mass value in a skill and retrieve it through an impact_event:
action physic_ent { my.skill1 = 10; // mass value ... phent_setmass(my, my.skill1, ph_box); ... }
function static_ent_event { if(event_type == event_impact) { my.skill1 = you.skill1 // skill1 contains now the mass value of the physics entity ...do stuff... } }
action static_ent { my.enable_impact = on; my.event = static_ent_event; }
Edit: For your other problem (stucking with ph_poly), have you tried to increase "ph_check_distance"? But itīs only available at 6.40 and above.
Last edited by fogman; 11/26/06 16:20.
|
|
|
Re: Get_Mass?
[Re: fogman]
#99890
11/26/06 16:42
11/26/06 16:42
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Thanks Fogman for your reply. Of course I could store the mass of an object in its skill for later retrieival, logical answer. One I hadn't even thought about doh! Still I wonder if there could be a quicker way to do this, maybe Get_Mass would be a valuable addition. Still your simple solution will do the job just as well. Thanks for that. I noticed some strange behaviour during events, where the my handle is empty during impact / friction etc. Maybe this is a bug or my code is screwy? My guess the later... It certainly gave me some problems in collision detection earlier... I've noticed the last few posts about physics I have read mention functions, such as ph_check_distance, which I have not come across in the manual I have, is there another refernece resource for Physics functions im missing? Im runnin GS Pro 6.40.5 and I will double check latest manual now. Really appreciate your help Fogman EDIT: I've just downloaded the latest beta manual for 6.50, maybe it will have some insights into the PE
Last edited by indiGLOW; 11/26/06 17:03.
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99891
11/26/06 17:11
11/26/06 17:11
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
ph_check_distance? This doesnt appear even in the beta manual, could you point me reference for this? Cheers EDIT: I AM AN IDIOT! Thunder pointed out how to search the manual correctly and now I have found it, please ignore the stupid comment above EDIT2: Ph_check_distance did not fix the sticky PH_POLY
Last edited by indiGLOW; 11/26/06 17:53.
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99892
11/26/06 18:04
11/26/06 18:04
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
Play around with "ph_setcorrections", "ph_setcontacts" and "ph_fps_max_lock", maybe this helps. Itīs strange, because the shape of a barrel isnīt that complicaded.
no science involved
|
|
|
Re: Get_Mass?
[Re: fogman]
#99893
11/26/06 18:45
11/26/06 18:45
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
After realising WED is opening an old manual and looking up 'ph_setcontacts', I have applied really hard settings: Code:
... ph_setgravity(vector(0,0,-386)); ph_setautodisable (8,8,3,0.01); ph_setcorrections(20000,0.1); ph_iterations = 10; ph_check_distance = 2.5; ph_setcontacts(vector(100000, 0,0), 0,0,0); ...
I have tried messing around with the above variables, and above is its current form, feel free to point out any anomolies there. I can provide an example of the behaviour and the model should it be of help. Here is the Physics code I have applied to the barrel models Code:
Action ExpBarrel { phent_settype(my, PH_RIGID, PH_POLY); phent_setmass(my, 1, PH_POLY); phent_setelasticity(my, 50,50); phent_setfriction(my, 50); phent_setdamping(my, 50, 50); phent_enable(my,1);
my.polygon=on;my.shadow=on; my.enable_impact = on; my.event = TriggerDamage;
}
As the models collide, they begin to stick together... It appears as if they are drawn together, eventually locking together. Thanks for your help, very much appreciated.
Last edited by indiGLOW; 11/26/06 18:47.
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99894
11/26/06 18:53
11/26/06 18:53
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
phent_enable(my,1); my.polygon=on;
Try to remove these instructions. The polygon hull will be applied through ph_poly. And "phent_settype" does the job. You donīt need phent_enable.
Iīll will make a quick test with some barrels.
no science involved
|
|
|
Re: Get_Mass?
[Re: fogman]
#99895
11/26/06 19:05
11/26/06 19:05
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
OP
Serious User
|
OP
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
The phent_enable(my,1) was previously set to 0, as in the test environment i wanted to disable physics until another physics object collided.
As for polygon=on, the physics ignores this but trace doesnt, so while redundant for this example, it is needed for the final product.
Still I have tested it already with this commented out and without the phent_enable calls, and they still stick together! lol - it's very strange.
I have some older examples of similiar physics setups I have done, which use poly too. I will take a look at them tomorrow evening...
Please let me know how your experiments go, I can provide you with the same barrel model if you like?
The Art of Conversation is dead : Discuss
|
|
|
Re: Get_Mass?
[Re: indiGLOW]
#99896
11/26/06 19:13
11/26/06 19:13
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
You can send it to "braindamaged[at]arcor.de"
no science involved
|
|
|
|