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.

DarkBASIC Professional Discussion / Sparkeys collision issue

Author
Message
BlackChaos
16
Years of Service
User Offline
Joined: 2nd May 2010
Location: London
Posted: 2nd Aug 2011 21:42


Basically I have made a level solely out of cubes(a box room). Next I download an already animated model from the DBP online shop(The one built into the DBPro software).

I setup sparky's collision of the box room and also on the player(As it is don in the Demo files that come with the .DLL).

The collision works on flat surfaces but not sloaps, the character model is like a whole meter off the floor(Slight exaggeration) and I cant seem to fix it nore can the moving object sit on the top of another object(Some times).

I don't know what to do anymore, this is the only reason why I am never able to create a fully functional game in DBPro

Is there an easier more native way such as ODE to get animated object with complex shapes to have correct physics. Also with Auto collision on(the default built in collision function) the object collides and slides with the front of one object but passes straight trough the back

bchaos101
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Aug 2011 22:36
When checking for collision with Sparky's, it's best to do sphere casts when checking collision for your player. The player is 1 meter off the ground because the center of the object is actually positioned at his feet, not in his stomach somewhere. This here should work:



TheComet

Black Chaos
15
Years of Service
User Offline
Joined: 20th Apr 2011
Location:
Posted: 3rd Aug 2011 17:28
Hey thanks, would you be able to put that into a full function? and possibly give me a quick schooling on how to apply angular gravity for sloaps

bconline
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Aug 2011 18:55
Sure, check out my thread on the code snippets board here : Sparky's Collision Example

That should explain all the things you need

TheComet

Black Chaos
15
Years of Service
User Offline
Joined: 20th Apr 2011
Location:
Posted: 3rd Aug 2011 21:44
Oh one more problem(Maybe a glitch with sparkeys dll)

Basically my character object will collide if I load the object, set it up with sparkeys collision and then code and other object(A floor) both with set object numbers.

Now the issue is after I've loaded the character object and set it up then try to run the program and load create a floor object(using, lets just say the upkey() and setup its collision) the character object does not collide with the floor object. Its like it doesn't exist

I have even tried loading the program first then load the character object(setup the collision straight away) then load the floor object(collision setup again while the program is running) but still nothing

Plzzzzzz shed some light.


p.s.

This is for a level editor hence my long winded explanations.


bconline
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th Aug 2011 01:42 Edited at: 4th Aug 2011 01:49
When your moving your player:
Record your old positions
.check your inputs
..move your player accordingly..
...decrement your gravity from your players Y position value
....check the collision
.....If a collision occurs, then retrieve the slide values and reposition the players position using these values... otherwise stick with the new values...

nb: If your players object is moving at a rate of 5 and its size is 5 then you should be aware that you may miss a collision.

EDIT: In some rare cases when the level map is awkward, sometimes you may have to add a ray-cast in the direction you're moving in, but the above method works 90% of the time.

Warning! May contain Nuts!

Login to post a reply

Server time is: 2026-07-10 17:19:47
Your offset time is: 2026-07-10 17:19:47