Page 1 of 1
Check if i'm jumping on top of another player
Posted: Tue Dec 10, 2013 6:47 pm
by Menyueru
First of all Thanks for this great Library it has really helped me a lot!!!
Well basically i'm trying to add something like platform style of gaming where u can jump on enemies and damage them, i guess i have to use an event for initiating supports or something like that, also I'm using the character controller for all the characthers.
Can you guys point me in the right direction?? Thanks in Advance!!
Re: Check if i'm jumping on top of another player
Posted: Tue Dec 10, 2013 7:19 pm
by Norbo
One of the easier options is to check the CharacterController.supportData.SupportObject. (The supportData will need to have a public accessor; it's currently private.)
If the SupportObject isn't null and HasTraction is true, then the character is standing on it. To know if the new support was caused by a landing, keep track of the previous supportData. If it goes from no support to supported, it's likely a landing. Keeping track of the pre-landing velocity would also give you a little more information. Check if the SupportObject is an enemy by using its Tag property and apply damage if appropriate.
Re: Check if i'm jumping on top of another player
Posted: Sat Dec 14, 2013 2:10 am
by Menyueru
I've only managed to test your solution now, it seems to work but i'm having a little problem the object that i'm receiving from support object is a CharacterSyncronizer object instead of the corresponding player i've previously assigned. What i'm asking is how can i get the enemy object o the characther controller at least so i could do the necessary health reduction and so on.
Thanks in Advance

Re: Check if i'm jumping on top of another player
Posted: Sat Dec 14, 2013 2:41 am
by Norbo
The CharacterController.Body.CollisionInformation.Tag is set to the CharacterSynchronizer, but you can use the Character.Body.Tag separately or create a subclass of CharacterSynchronizer which includes a reference to your game logic object.
To get the Entity associated with a BroadPhaseEntry (if one exists), attempt to cast the entry to an EntityCollidable and check the EntityCollidable.Entity property if the cast succeeds.
Re: Check if i'm jumping on top of another player
Posted: Sat Dec 14, 2013 3:00 am
by Menyueru
Thanks Norbo!!! i love how fast you always answer.
Norbo wrote:
To get the Entity associated with a BroadPhaseEntry (if one exists), attempt to cast the entry to an EntityCollidable and check the EntityCollidable.Entity property if the cast succeeds.
this worked just fine thanks
