Box2D Forums

It is currently Sat May 25, 2013 1:31 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Jun 02, 2011 2:12 pm 
Offline

Joined: Tue Feb 24, 2009 4:10 pm
Posts: 564
Location: Michigan
Code:
var wm:b2WorldManifold = new b2WorldManifold();
ce.contact.GetWorldManifold(wm);
trace("wm.normal.y: "+wm.normal.y);

for most of my valid contacts with platforms this returns -1 while i stand on top of them.
recently about 15% of platforms have started returning 1 while i stand on top of them.

the platform contact filtering still returns correctly, so i stand on the platform, just my wm.normal.y which i use to check if i can jump is wrong.
Code:
var m:Matrix = matrix.clone();
m.tx = 0;
m.ty = 0;
m.invert();
var n:V2 = b2body.GetLocalVector(e.normal);
var p:Point = m.transformPoint(n.toP());
e.contact.SetEnabled(p.y < -0.6);



I've check the transform matrix. they seem to be the same. all platforms are generated from the same library movieclip...

any idea what i did wrong to cause this?
i haven't run into this on my other projects.

the current game is simple enough that i will just add an ugly work around for now. but on other projects this could be a big problem for me, so i would appreciate any help sorting it out.


Top
 Profile  
 
PostPosted: Sun Feb 19, 2012 3:04 pm 
Offline

Joined: Mon Aug 29, 2011 8:27 pm
Posts: 12
Hi sketchbookgames

I've just had the same problem happen to me! I played around with my level a bit and figured out that the platforms have to be behind the player (sent to back) to return -1.
If they are in the front, they will return +1.

I've tested this and everything seems to work :D


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: Google [Bot] and 3 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