Adding Physics behavior at run time

Get help using Construct 2

Post » Thu Jul 05, 2012 3:31 pm

Hi guys,

is there any way to add or delete physics behavior to an object at run time.
I have like maybe 50-100 physics object . and must of them are inactive all the time. they get activated when another object overlaps them.

And if there is no way to do so, What is the maximum number of physic objects on the layer that don't affect the performance in mobile devices.

And Can I have like 100 physic object which are immovable, I just use them with another movable object like a ball.


Thanks
Haroon Shishani
B
5
Posts: 19
Reputation: 770

Post » Thu Jul 05, 2012 3:46 pm

what about using immovable and movable?? so you set at the start to immovable and when the object collision with them it change to movable ^^
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Thu Jul 05, 2012 3:53 pm

Yes it sounds good idea.
So when the object is immovable, does it mean I can have as much as immovable Physic object with no performance lack issues.
I just wanna know What is the maximum count of immovable physic objects is recommended to have.

And Thanks zsangerous for your reply :)

B
5
Posts: 19
Reputation: 770

Post » Thu Jul 05, 2012 3:54 pm

No idea if physic objects use up space when not being computed, but if they do just use placeholder sprites for the location of the objects, and destroy the placeholder and spawn the physic object upon collision?

To account for the physic effect being affected, the placeholder could have it's hitbox invisible and slightly larger than the actual object, so the physic object would be spawned before genuine contact.Mr E Bear2012-07-05 15:55:44
B
49
S
14
G
3
Posts: 540
Reputation: 5,611

Post » Thu Jul 05, 2012 4:16 pm

see first of all if the objects doesn't have alot of animations you can combine them into 1 object it will be better than 100 objects. also you can use as much as construct2 limit can hold , but yes put a variable to the objects so not all of them will be movable when you hit 1 of them ( put a boolean)

boolean = true ---> movable
boolean = false --> immovable.
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Thu Jul 05, 2012 4:17 pm

@Mr E Bear , you idea is good but it will lower the fps so the variable and events are better than 3x objects while he is using 100 objects
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Thu Jul 05, 2012 4:25 pm

actually the placeholder object is probably the best approach for me since my 100 objects are exactly the same.
it's sounds very good idea to use the placeholder, I will diffidently try it.
And I have another scenarios to use the Immovable property that would work great :)

Thank you guys
B
5
Posts: 19
Reputation: 770

Post » Thu Jul 05, 2012 6:27 pm

I just wanted to say it worked great, when the distance of the ball and the object is with in a specific range i create the placeholder object in the position where the ball fall, and I destroy the object when the ball leaves that distance :)
B
5
Posts: 19
Reputation: 770


Return to How do I....?

Who is online

Users browsing this forum: mercuryus, Naightwolf, RookieDev, Skebab and 22 guests