Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,449 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Colllision events in Physics #28504
06/07/04 16:36
06/07/04 16:36
Joined: Jan 2004
Posts: 107
India
L
Lord_RazermanX Offline OP
Member
Lord_RazermanX  Offline OP
Member
L

Joined: Jan 2004
Posts: 107
India
In the normal A5 engine lets say if a ball collided with a wall a sound was produces via an event_impact, now I want the ball to produce sounds while colliding with the wall or the floor but just when it collides , it should not happen that when the ball rests on the floor it keeps playing a sound, how do I achiev this for Physics object. Is it done by enable_poly.. if yes can someone please show me a small snippet of a collision sound or something relevant , Thanks.


Our team is looking for prospective members. Intermediate skills are minimum, No amateurs. Our team can have members from anywhere ,so long theres an international bank around We need a modeller,2d artist and level designer
Re: Colllision events in Physics [Re: Lord_RazermanX] #28505
06/07/04 21:21
06/07/04 21:21
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
I would start by sampling the velocity via phent_getvelocity and turn the sound off if the speed is zero. You can sample every second and it will still look and sound realistic without the system taking a big performance hit

Re: Colllision events in Physics [Re: Lord_RazermanX] #28506
06/07/04 21:57
06/07/04 21:57
Joined: Jan 2004
Posts: 107
India
L
Lord_RazermanX Offline OP
Member
Lord_RazermanX  Offline OP
Member
L

Joined: Jan 2004
Posts: 107
India
I can do that , but if you do it for a lot of objects , a lot of calculations are added every second, for one object no performance probs but what about a lot of them, also if the ball is moving on the ground(not bouncing) a sound must not be produced, is there any other way?


Our team is looking for prospective members. Intermediate skills are minimum, No amateurs. Our team can have members from anywhere ,so long theres an international bank around We need a modeller,2d artist and level designer
Re: Colllision events in Physics [Re: Lord_RazermanX] #28507
06/07/04 22:08
06/07/04 22:08
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
How many objects are we talking about and running at what fps?

Re: Colllision events in Physics [Re: fastlane69] #28508
06/07/04 23:59
06/07/04 23:59
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i would simply check the entity's velocity along the normal of the collision surface and only play the sound if this velocity is above a certain threshold value. the volume of the sound should also depend on this velocity. i am quite sure that this method would be fast enough even with lots of entities (we aren't talking about thousands of entities anyway because physics would be too slow then). the impact sound effect shouldn't get started continously if the entity just rolls or slides because the velocity along the normal should be 0 (or very close to it) then.

...but i never tested this because i wasn't that interested in sound effects so far!

Re: Colllision events in Physics [Re: ventilator] #28509
06/08/04 00:14
06/08/04 00:14
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline
Expert
A.Russell  Offline
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan
I'm going to have this same problem shortly.

I haven't tried this, but I suspect it should work. When your object is rolling on a surface it should be colliding with it all the time, or nearly all the time, and when it is bouncing there should be intervals between collisions. Check for collision, and if positive play sound and set a flag. Then see how long it takes before it returns false. Don't play the sound again until there hasn't been a collision with the same object for a reasonable time ( a few frames or whatever, experiment).

And if you get it working before I do, please let me know

(I haven't figured out how to check for collision with physics objects. I've always used ent_move for this. If someone could shed some light on how it is done)



Last edited by A.Russell; 06/08/04 00:23.
Re: Colllision events in Physics [Re: A.Russell] #28510
06/08/04 04:05
06/08/04 04:05
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
Use EVENT_FRICTION and phent_getvelocity. Then check the appropriate row of the velocity vector, e.g. for a ground plane just look at phent_getvelocity().Z, if it is above a certain threshold play a sound. It might increase or decrease performance depending on your game, if you do a phent_getvelocity call for each physics entity once per frame and store the values in an array. This way if your phent collides with 3 other objects during the frame you only have to query the velocity once.

Re: Colllision events in Physics [Re: fastlane69] #28511
06/08/04 22:15
06/08/04 22:15
Joined: Jan 2004
Posts: 107
India
L
Lord_RazermanX Offline OP
Member
Lord_RazermanX  Offline OP
Member
L

Joined: Jan 2004
Posts: 107
India
The problem is just the floor , wall are easy , since you can treat them as entity but floor is tough. I dont know how to use event_friction yet , it seems my manual is outdated since I am not getting any help there, is this covered in the new manual, so I will download it.

Second , yes this seems to be a good solution that as long as the object has vertical speed and it collides, sounds of varying intensities may be produces, this is actually working to some extent, but the problem still exists.

I will work on this code if, I manage to get it right, I will post it here.
Thanks guys.


Our team is looking for prospective members. Intermediate skills are minimum, No amateurs. Our team can have members from anywhere ,so long theres an international bank around We need a modeller,2d artist and level designer
Re: Colllision events in Physics [Re: Lord_RazermanX] #28512
06/10/04 15:34
06/10/04 15:34
Joined: Jan 2004
Posts: 107
India
L
Lord_RazermanX Offline OP
Member
Lord_RazermanX  Offline OP
Member
L

Joined: Jan 2004
Posts: 107
India
Just an update, this is a real tough cookie.
If i use threshold z velocities I have 2 problems, the velocities differ for different heights owing to gravitiation acceleration , second , the phent_getvelocity fucntion for every frame brings down the frame rate by upto 15 % max.Did someone else gat a code to achiee this?


Our team is looking for prospective members. Intermediate skills are minimum, No amateurs. Our team can have members from anywhere ,so long theres an international bank around We need a modeller,2d artist and level designer
Re: Colllision events in Physics [Re: Lord_RazermanX] #28513
06/10/04 20:19
06/10/04 20:19
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:

the velocities differ for different heights owing to gravitiation acceleration




This should obviously not be. I too have had problems with an inconstant gravity, but haven't had to time to track it down. In my case, my falling velocity rate was constant and then strated fluctuating as I got closer to the ground. Naturally, gravity should remain constant at thus I should gain a constant amount of Velocity each second. What I observed is that the rate DECREASED as I got closer to the ground. Again, haven't had time to fully investigate this, but as I recall, I had no code except PE in my drop and thus to me this was a PE problem.

Quote:

the phent_getvelocity fucntion for every frame brings down the frame rate by upto 15 % max




I've had up 100 entities all registered with the PE and all geting velocity and I noticed no major frame drop (stayed at 58-60 the whole time).

Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1