Hello,
I'm working on a platform game, but i can't decide if should i use the physics module or Hardon Collider to do some movements like these:
(The object rotate when falls from a corner)
(The object go up on the platform, even if it's a rotated rectangle)
(The object is jumping and is able to slide when touch the ceil)
Is the love.physics module necessary or may the Hardon Collider be enough?
Which one is more efficient?
How can I do that movements?
If my project have a tile-based map, which one is the best alternative to deal with it?
What method may be more efficient to detect collisions with every tile?
* I'm sorry about my english.
Collisions - love.physics or Hardon Collider?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Re: Collisions - love.physics or Hardon Collider?
You may want to look at:
viewtopic.php?f=5&t=76983
It depends on how much physics you want to implement into your game.
Hardon collider implements minimal physics and therefore may not be optimal if you are trying to implement complex physics. In your example from the corner example I can see that the plugin that you require will need physics in some form as the colision rectangle is rotated based upon the surface it has colided with. STI mentioned above has something similar to that.
Although I don't doubt that you can program that in without physics, if you are willing to put the effort in.
viewtopic.php?f=5&t=76983
It depends on how much physics you want to implement into your game.
Hardon collider implements minimal physics and therefore may not be optimal if you are trying to implement complex physics. In your example from the corner example I can see that the plugin that you require will need physics in some form as the colision rectangle is rotated based upon the surface it has colided with. STI mentioned above has something similar to that.
Although I don't doubt that you can program that in without physics, if you are willing to put the effort in.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Re: Collisions - love.physics or Hardon Collider?
Uhm...
If my project have a tile-based map, which one is the best alternative to deal with it?
What method may be more efficient to detect collisions with every tile?
If my project have a tile-based map, which one is the best alternative to deal with it?
What method may be more efficient to detect collisions with every tile?
Re: Collisions - love.physics or Hardon Collider?
Did you have a look at STI (the link I posted)? It looks the closest to what you might want although if you dislike it then I'd say go with hardon collider.AlexsSteel wrote: If my project have a tile-based map, which one is the best alternative to deal with it?
Its a strange question. Why would you want to check collision with every tile? Do you have a player? Or are you working on a particle based game?AlexsSteel wrote: What method may be more efficient to detect collisions with every tile?
If you already have a player then you can just check if the player's collision box collides with anything and then if it's a tile then do something such as set the y velocity or x velocity on the time of collision. For simple collision such as that you can use Hardon Collider.
If you are working on a particle based game then go for love.physics.
But consider that jumping into love.physics may overwhelm you a little bit especially if you just started out with love2d.
However I am not sure if you will be able to use hardon collider for slopes and your corner example..
There is a good read on platformer colisions:
http://higherorderfun.com/blog/2012/05/ ... atformers/
Give me the type that you want from the above link and I will try to estimate what you can use.
You may want to read through the hardon collider reference and have a look at its functions such as
Code: Select all
function HC:setPassive(shape, ...)
Re: Collisions - love.physics or Hardon Collider?
Your choice should really be based on whether you want physics behaviour for your character.
If you want to bounce boxes around, have things bounce off the player, throwable stuff - box2d should be your choice.
If you want tight controls - other collision routines will give you more control. You can do an oldschool platformer with box2d but you'll invest a lot of time making box2d not do what it wants to do - classic platformers are pretty much counter-physics.
Both can be made to perform well enough in a tile based world.
If you want to bounce boxes around, have things bounce off the player, throwable stuff - box2d should be your choice.
If you want tight controls - other collision routines will give you more control. You can do an oldschool platformer with box2d but you'll invest a lot of time making box2d not do what it wants to do - classic platformers are pretty much counter-physics.
Both can be made to perform well enough in a tile based world.
Re: Collisions - love.physics or Hardon Collider?
I agree with bizziboi, you can use Box2d (aka "love.physics") to get similar results to what you want but it probably won't look exactly as you expect.
It will occur when the center of mass of the box goes past the corner of the platform.
Also, the rate at which it rotates will depend on the velocity of the box.
In an old-school platformer you could just play an animation of the character falling.
In particular, a box will not just slide up corners of slopes, but will usually roll or get stuck as it hits the corner.
Even if you use a circle or an octagon as in your illustration it won't look right.
Primarily because the object will be redirected sideways as it hits the corner.
Jumping is like launching a projectile - imagine throwing a ball at the edge of the ceiling.
It will also lose vertical velocity as it hits the corner, especially if it has friction.
So yes, it can work but it won't "feel" the same like in classic platformers such as Super Mario Bros.
Generally there is a tradeoff between an accurate physics simulation and tight controls.
Yep, that should work well with Box2d.(The object rotate when falls from a corner)
It will occur when the center of mass of the box goes past the corner of the platform.
Also, the rate at which it rotates will depend on the velocity of the box.
In an old-school platformer you could just play an animation of the character falling.
That will work too but you may have trouble with the corners of "slopes".(The object go up on the platform, even if it's a rotated rectangle)
In particular, a box will not just slide up corners of slopes, but will usually roll or get stuck as it hits the corner.
This one will be tricky for Box2D.(The object is jumping and is able to slide when touch the ceil)
Even if you use a circle or an octagon as in your illustration it won't look right.
Primarily because the object will be redirected sideways as it hits the corner.
Jumping is like launching a projectile - imagine throwing a ball at the edge of the ceiling.
It will also lose vertical velocity as it hits the corner, especially if it has friction.
So yes, it can work but it won't "feel" the same like in classic platformers such as Super Mario Bros.
Generally there is a tradeoff between an accurate physics simulation and tight controls.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Re: Collisions - love.physics or Hardon Collider?
Thanks for the replies, i'm going to try using Box2D, but i have just one more question:
It's posible to do something like this using a rectangle (or any other shape) with fixed rotation?
It's posible to do something like this using a rectangle (or any other shape) with fixed rotation?
Re: Collisions - love.physics or Hardon Collider?
Yes, Box2D supports bodies with "fixed rotation".
"Fixed rotation" is useful for circle shapes too if you want them to produce friction without rotating.
Also, take a look at "setGravityScale(0)" so that your objects don't slide off slopes.
"Fixed rotation" is useful for circle shapes too if you want them to produce friction without rotating.
Also, take a look at "setGravityScale(0)" so that your objects don't slide off slopes.
- AlexsSteel
- Prole
- Posts: 17
- Joined: Sat Dec 27, 2014 2:11 am
Re: Collisions - love.physics or Hardon Collider?
Thanks for your help, i will try it.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests