Is it possible to change Collision Polygon at runtime?

For developers using the Construct 2 Javascript SDK

Post » Thu May 15, 2014 9:40 pm

Can I change the Collision Polygon of an object at runtime? Add / remove nodes and move nodes around?
B
40
S
11
G
4
Posts: 665
Reputation: 8,453

Post » Fri May 16, 2014 9:00 am

It's not supported. The engine caches collision poly data in various places, so if you change it the caches won't update and things will be broken.
Scirra Founder
B
397
S
236
G
88
Posts: 24,408
Reputation: 194,486

Post » Fri May 16, 2014 9:44 am

Thanks @Ashley !
Less work for me I guess :P
B
40
S
11
G
4
Posts: 665
Reputation: 8,453

Post » Fri May 16, 2014 2:25 pm

Use an invisible shape as your collision polygon, pin it to your player or sprite. If you need to change it, destroy it and pin a different shaped invisible object to your sprite. Just like using a square or rectangle, but you can use any shape you want.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Fri May 16, 2014 4:20 pm

@BluePhaze yeah people will have to do that. I was asking because it could have been useful inside my plugin :)
B
40
S
11
G
4
Posts: 665
Reputation: 8,453


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests