Slick Forums

Discuss the Slick 2D Library
It is currently Sat Feb 17, 2018 9:00 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Sep 21, 2008 10:09 am 
Offline

Joined: Thu Jun 19, 2008 4:29 pm
Posts: 4
Hi,

I have the following problem: I'm using Phys2d for collision detection for a platformer right now. The logic is sort of modeled after the alien-platformer demo, but the map consists of polygons loaded from an SVG file instead of tiles, the player is represented by a non-rotating box. What I want to do is to check for any edges that are too step for the player to climb, so I take the last collision event that occured and look at its normal - if its angle is above a certain value, the player can't move upwards.

For testing purposes I tried drawing the collision normal as a line drawn at the point of the collision, and I noticed that it is not always the same - it constantly jumps between at least two directions when the player moves, one seems to be right and directly perpendicular to the edge I'm moving on, and at other times it is off by quite a few degrees, usually something like 20-30°. I guess this depends on which edge of the player polygon exactly is detected to collide against the floor polygons.

So my question is: How can I detect the perpendicular vector to the edge I collided with as exactly as possible, meaning I always get the same collision normal everytime I collide with the same edge?

Thanks in advance,
Roland


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 2:54 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
I'm really sorry, I'd missed this one altogether. Is this still a topic for discussion or have you long since discovered your answers and/or moved to JBox2D?

Sorry again,

Kev


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 29, 2008 9:10 am 
Offline

Joined: Thu Jun 19, 2008 4:29 pm
Posts: 4
No, I haven't been able to resolve this by now, I did a few other things in the meantime. About JBox2D: Would you recommend moving to it? We are currently working on an Action-Platform game using Slick, and it is possible that we may have quite a lot of Actors onscreen at the same time - can't really say any specific numbers yet, but I guess it could easily be > 100, where only a fraction of them needs full physics & collision support however. Also, the game won't use tiles but polygons (think "Mootox" as a platformer ... with lots of shooting) - do you think such a game would be "too much" for Phys2d? I would rather not have to switch, since we already put quite some effort into it right now, but if it proves beneficial in the futue, it'd probably be worth it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2008 11:20 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Phys2D will probably be ok for small numbers of bodies and as far as I know still provides the more simple API to work with. However, JBox2D is likely to scale much better and has a much quicker development cycle atm (I'm not actively developing Phys2D at the moment since I'm not currently using it for a project).

If you're still using it I'll try and resolve whats going on with the collision normals or at least find an explanation that can be used to work round it.

Kev


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group