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 GDK / Gravity in Dark GDK with Sparky's Collision

Author
Message
Alexw
13
Years of Service
User Offline
Joined: 22nd Feb 2011
Location:
Posted: 28th Feb 2011 12:53
Hey,

I got the follow code in my movement script:


Now the first collidefloor is for checking if he can go up on stairs.
That is working very good. But now i want to add script that i can go downwards, and a script to put gravity in, you if he jumps off a wall then he just go down, for now he just hangs in the air.

I hope someone can help me with this.

Thanks,
Alexw

Alexw
Alexw
13
Years of Service
User Offline
Joined: 22nd Feb 2011
Location:
Posted: 28th Feb 2011 19:35
UPDATE:

I got the follow code now:


But the problem now that he go trough the floor instead of stopping...

Any solutions?

Alexw
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st Mar 2011 01:51
I actually found it much easier using the SphereCast collision for holding onto ground/terrain. I've added a project into the codebase forum with a fully working sliding collision, gravity, jump code within it.

Without seeing the code working I can't see much with your code. I would rather use raycast for such things as avoidance ai, laser guns, simple stuff like that.

Warning! May contain Nuts!
Alexw
13
Years of Service
User Offline
Joined: 22nd Feb 2011
Location:
Posted: 1st Mar 2011 12:18
If i use SphereCast i get stuck, cant move.
See my coding in the attachement...

Please note that i will remove this attachment when my problem is fixed.

Alexw

Attachments

Login to view attachments
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 2nd Mar 2011 20:57 Edited at: 2nd Mar 2011 21:00
When you use sphere cast, exclude the object itself from the cast, otherwise it will collide with itself and won't move.

I noticed that you use a matrix for the floor. I'm not sure you can use a matrix in collision checks. Try with a solid object, a plane or an X model.

If it must be a matrix, you can get the height at a given point with dbGetGroundHeight and compare that to your character's Y coordinate to stop it from falling through the matrix.
Alexw
13
Years of Service
User Offline
Joined: 22nd Feb 2011
Location:
Posted: 3rd Mar 2011 12:03
I tryd the followed:


But i still get stuck, and its still moving trough the floor...

Alexw
Alexw
13
Years of Service
User Offline
Joined: 22nd Feb 2011
Location:
Posted: 3rd Mar 2011 23:10
Edit: Im not using that floor. I did not delete it yet, im still testing things out.
The floor is just the floor that is represented in the city model...

Alexw

Login to post a reply

Server time is: 2024-11-19 12:43:09
Your offset time is: 2024-11-19 12:43:09