Box2D Forums

It is currently Thu May 23, 2013 6:42 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Jul 04, 2012 12:29 pm 
Offline

Joined: Wed Jul 04, 2012 12:27 pm
Posts: 1
I'm creating box2d game and trouble is as follows: Two fighters located on arena, top view. Fighters has weapons like sword in theis hands. I want to fighter bounces in hit direction when damaged by opponent, but fighters has same physical characteristics and applied impulse is not sufficient to bounce fighter considerably. How can I increase applied by box2d impulse in same (correct) direction? I overrided PostSolve method, but I don't understand how to affect to b2ContactImpulse passed to method. I think I just need increase value of that impulse, but I dont know how. Could someone explain me how to do it? Thanx!


Top
 Profile  
 
PostPosted: Fri Jul 06, 2012 12:56 pm 
Offline

Joined: Sun Oct 25, 2009 3:28 am
Posts: 242
Multiply impulse.normalImpulses[0] by the amount you want to increase. This is a Number, so yeah. I'm actually not sure if changing this (i.e. assigning impulse.normalImpulses[0] with a different number) will affect anything (since it's post solve). If changing that number doesn't work, you can try to apply the impulse manually (body.ApplyImpulse(worldDir:b2Vec2,worldPos:b2Vec2)).

Here is an page about using b2ContactImpulse: http://blog.allanbishop.com/box-2d-2-1a ... -strength/


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

All times are UTC - 8 hours [ 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
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group