Adam's Lair Forum

game development and casual madness
It is currently 2017/04/28, 14:10

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2017/02/25, 15:32 
Junior Member
Junior Member

Joined: 2017/02/05, 13:06
Posts: 29
Role: Hobbyist
I'm trying to implement a jump where the character may only start a jump while standing on something (rather than allowing him to jump in mid-air)
I implemeneted the ICmdCollisionListener interface on the player component and added a simple bool _isInCollision which is set to true in OnCollisionBegin and set to false in OnCollisionEnd.

The problem I'm having is that while the player is standing firmly on the ground both events are being hit and the bool toggles between true and false, resulting in sometimes needing to hit the jump button multiple times to get the KeyHit event to trigger while the bool is true.

Any idea why the OnCollisionEnd method is being called even when collision doesn't appear to have ended? Maybe I'm thinking about this wrong, maybe the "collision" just refers to the initial contact between two rigid bodies, if that is the case how else can I call if the player is in constant contact with something?


Top
 Profile  
 
PostPosted: 2017/02/25, 16:35 
Junior Member
Junior Member

Joined: 2017/02/05, 13:06
Posts: 29
Role: Hobbyist
Okay nevermind it was my mistake. I had code that would accelerate the player downward faster (I wanted the player to fall faster than other objects in the game so I didn't want to change the global gravity)
this was continuing to happen even after the player hit something so it was causing this collision on/off


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group