Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to create a perfect collision box around an irregular object
Started by benj.jones7 Oct 06 2019 08:35 AM

2 replies to this topic
hitbox collision
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

benj.jones7

[GLOBAL: userInfoPane.html]
benj.jones7
  • Observer

  • 1 posts
  • Corona SDK

For the main 'character' of my game I have a BMX bike as a PNG, at the moment of its collison box I'm using a  rect. I need the hitbox to me more precise for the shape of the bike as at the moment it only balances on the square rectangle not the individual wheels.

 

I'm quite new to corona, any ideas as to how I'd manage to match the shape of the bike for my collision box.

 

Thanks!



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,020 posts
  • Corona SDK

You can either create a physics object out of multiple elements, or create an outline or a chain body, or create multiple independent physics objects and put them together using joints.

 

One easy method for creating irregular shapes (through multiple elements) is a 3rd party software called PhysicsEditor. PE will let you create multibody objects with ease and then export them to Corona.

 

-

 

You can check the documentation for physics bodies and joints, or you could take a look at some Corona sample projects. For instance, start your Corona simulator, then press help > sample projects, and navigate to joints. You'll find a rudimentary "car" built using wheel joints there.


  • roaminggamer likes this

[TOPIC: post.html]
#3

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 661 posts
  • Corona SDK

I use physics editor too.

 

@benj.jones7 should also check out texture packer by the same company when you are ready to use sprite sheets to save texture memory.




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: hitbox, collision