Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Dark Physics - collision alternative

Author
Message
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 24th Sep 2007 01:26
I'm tweaking my rolling ball game and need to check whether an object is or isn't rolling across a surface. Basically, I don't want force to be applied to the ball unless it IS on a surface - otherwise, when its in the air - it goes flying!

It can't be done with darkphysics collision as it only returns the last object numbers (that collided) and never gives a 0 if there no collision.

I'm trying raycasting with distance too but it sometimes gives an error and gives an incorrect distance.

Can't find any stuff showing how to set up sparky's collision and don't know if it will be of any use for this.

Anyone got any tips?

BiggAdd
Retired Moderator
20
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 24th Sep 2007 15:37 Edited at: 24th Sep 2007 15:46
I posted this here a while back. May help you. Click the mouse to jump. Using CCD in dark physics I can only apply an upward force to the ball when the ball is touching the ground.

Sig removed by BiggAdd because he is everywhere.
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 25th Sep 2007 12:05 Edited at: 25th Sep 2007 12:05
Thanks for that, that helped a little but the code only works 100% if the only objects in the scene are the static level and the ball. If there are other objects likely to collide the collision commands as they stand become quite useless. I may try the standard collision commands...

I think we need commands to constantly search for collisions with a specific object in Dark Physics.

Like:
Quote: "collision = phy get collision for object no(object no.)
x = phy get collision for object x(object no.)
y = phy get collision for object y(object no.)
z = phy get collision for object z(object no.)
vector = phy get collision for object vector(object no.)
phy clear collision data() "


If no collision is occuring then it should return a zero. If there is should return a number other than zero.

BiggAdd
Retired Moderator
20
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 26th Sep 2007 23:22 Edited at: 26th Sep 2007 23:23
Actually you can replace the code on line 55 with this. This will do the trick:



The command Phy Get Collision Data() will check all rigid bodies in the DP world. Hope this solves your problem.

Sig removed by BiggAdd because he is everywhere.
Redmotion
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Mmm mmm.. Marmite
Posted: 27th Sep 2007 17:05 Edited at: 27th Sep 2007 17:08
Actually, reading the manual again (as you do) I noticed that the correct way to read collision in Dark Physics is as follows:



The code is as you wrote originally. However, I've realised that the collision checks need to occur WITHIN the while loop otherwise it cannot scan through the ENTIRE collision stack. If the check only happens at the end of the loop it only checks the last collision detected and half the stack will be missed if many collisions are occuring.

I'll try this tonight and post up how things develop.

Cheers.

Login to post a reply

Server time is: 2024-09-08 00:45:06
Your offset time is: 2024-09-08 00:45:06