Nape Engine and Kinematic collision

10 posts (showing 1-10)
DelaniStudio

Market Level 2Community Level 5
370 posts

I have one problem, I am using Nape engine, and i have created Bullet and it's body is kinematic,
problem is when i fire that bullet i can't get collision with wall(body.static)..i don't know... But when i change bullets body from kinematic to dinamic i get collision but then bullet don't dont acts like bullet but gravity pulls him down.

Is it possible maybe to get collision between static and kinematic body somehow?  I want to create effect simmilar to this. There is option .allowMovement for body when its dinamic,but after i use that i loose collision and acts like body is kinematic even if its body.dinamic. 

posted 2015-05-02T01:26:14-07:00
danishgoel

Market Level 5Community Level 6
545 posts

Kinematic and Static bodies will not interact with each other.
Try setting the gravMass property to 0 for bullet:

var gravMass : Float
- Mass used in gravity computations in a Space.
Setting this value will implicitly change the gravMassMode to FIXED.
Set to 0 to disable gravity for this Body.
posted 2015-05-02T07:42:47-07:00 | edited 2015-05-02T07:45:35-07:00
DelaniStudio

Market Level 2Community Level 5
370 posts

Yea i have tried and when collision happen bullet starts floaring in mid air toward 0,0 on x axis... I mean its so dumb why static and kinematic bodies cant colide?

posted 2015-05-02T09:48:30-07:00
ozdy

Market Level 6Community Level 13
1482 posts

I think kinematic objects are great for moving platforms! Anyway, I've solved your problem  for bullets with dynamic objects by negating gravity with opposite vector and recalculating velocity to be constant after impact if needed. You can check it here - http://ozdy.com/games/cowboy-vs-martians.html

posted 2015-05-02T10:18:00-07:00
DelaniStudio

Market Level 2Community Level 5
370 posts

Yea ozdy i agree with you ONLY FOR MOVING PLATFORMS , I am new to nape so i wasted hours trying to fix collision i thought it was my mistake in code but in the end i was just doing nothing...will do that and it should work i guess

posted 2015-05-02T10:24:14-07:00
ozdy

Market Level 6Community Level 13
1482 posts

punisher0504 said:

Yea ozdy i agree with you ONLY FOR MOVING PLATFORMS , I am new to nape so i wasted hours trying to fix collision i thought it was my mistake in code but in the end i was just doing nothing...will do that and it should work i guess

Moving platforms, moving collectibles, flying enemies, buzzsaws even! How would you make a buzzsaw Meat Boy style if it collided with the ground :P

posted 2015-05-02T10:28:23-07:00 | edited 2015-05-02T10:29:11-07:00
keybol

Market Level 9Community Level 13
2985 posts

kinematic is the same as animated in box2d?

posted 2015-05-10T02:14:38-07:00
DelaniStudio

Market Level 2Community Level 5
370 posts

Mope,kinematic in nape is type of body it can be dynamic,static or kinematic

posted 2015-05-10T07:50:17-07:00
Geovizz

Market Level 5Community Level 1
62 posts

Actually, static and kinematic bodies in nape DO collide with each other. I think you should check cbTypes of your bodies or an interaction listener type

posted 2015-05-10T18:53:07-07:00
fatunicorn

Market Level 0Community Level 0
0 posts

are they ? 

try to add sensor to bullets and detect sensor type collisions. that way You should be able te detect collisions and avoid gravity etc.

posted 2015-12-22T13:23:56-08:00