Can I stop Collision Polygon from rotating?

Get help using Construct 2

Post » Wed Jul 17, 2013 7:33 am

A rather simple question really; is there any way that I can stop a collision polygon from rotating if the sprite needs to be rotated - it seems to be causing multiple problems with pathfinding.

Thanks in advance :)
B
39
S
7
G
2
Posts: 131
Reputation: 3,827

Post » Wed Jul 17, 2013 7:55 am

Um...I know one thing you can do is use an invisible sprite for collision detection and pin the visible object to that, then the visible object can rotate and the other sprite doesn't have to. I don't know if that helps but I don't believe you can actually prevent an objects collision box from rotating if the object is rotating.
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Wed Jul 17, 2013 8:11 am

Yeah, after a little messing around, this is the solution I also came up with. It basically means treating the character as a tank - movement on the base with no rotation with a rotating character pinned on top that controls the shooting. Speaking of which, is it better to pin, or attach every tick?

I was also just curious if there were any other methods?
B
39
S
7
G
2
Posts: 131
Reputation: 3,827

Post » Wed Jul 17, 2013 9:15 am

[QUOTE=Sean Noonan] I was also just curious if there were any other methods?[/QUOTE]

I think the invisible collision box sprite pinned is the best method.
As to rather pin or move every tick, it really depends on what is going on in your game.
Pinning (position only) on start of layout or on creation of the sprite/object/character will allow you to only deal with it once and rest assured the collision polygon you're looking for will always be aligned with its correct sprite, at the correct angle no matter what.

Positioning every tick allows you to be able to have a more precise control over the positioning in case you would like to have some offset, or apply some special operations at will.
There is no "absolute best" here, just what fits best the game you're making.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
268
S
96
G
67
Posts: 7,219
Reputation: 73,729


Return to How do I....?

Who is online

Users browsing this forum: OddConfection, senna68, smlyldz and 10 guests