[(mostly) solved] Argh why won't the collisions worrrrk

For questions about using Classic.

Post » Tue Apr 20, 2010 12:06 pm

Cap is here. So I tried applying physics with bounding box to the TiledBackgrounds, collisions were horribly messed up. Okay, I thought, guess tiledbackground doesn't like to play along with physics, I'll make a foreach loop to put a physics enabled Sprite over each tiledbackground to handle collision, result: Collisions are EVEN MORE fucked up!

version is 0.99.84, doesn't work in latest stable either. I'm sure I'm doing something really stupid but for the life of me I can't figure out what so someone please help pretty please :D
B
2
S
2
G
3
Posts: 193
Reputation: 1,636

Post » Tue Apr 20, 2010 3:02 pm

The hotspot on your physics sprite needs to be centered for collisions to work properly. You'll have to compensate for new hotspot to get the sprites lined up with the backgrounds, but that's pretty easy:

X: TiledBackground.X + TiledBackground.Width / 2
Y: TiledBackground.Y + TiledBackground.Height / 2

I hope this helps. :)
Moderator
B
97
S
36
G
19
Posts: 1,584
Reputation: 17,692

Post » Tue Apr 20, 2010 3:40 pm

Ah, that fixed it, thank you. :D
But the reason I don't usually centre hotspots is because the object then no longer aligns to the grid properly. I'm assuming the physics broken-ness when the hotspot is non-centre is considered a bug?
B
2
S
2
G
3
Posts: 193
Reputation: 1,636

Post » Wed Apr 21, 2010 12:14 pm

[quote="Dataflashsabot":e8q5s42j]Ah, that fixed it, thank you. :D
But the reason I don't usually centre hotspots is because the object then no longer aligns to the grid properly. I'm assuming the physics broken-ness when the hotspot is non-centre is considered a bug?[/quote:e8q5s42j]

im pretty sure it is. theres a line of code that should be in there somewhere but isn't. the line of code which places the center of rotation in the center of the sprite for physics purposes.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests