Dynamic Colliders for a Growing Rigidbody, is it possible to do this with normcore?
Hello,
I'm having a go at making a sort of Katamari Damacy game where a ball gets bigger as it collects stuff. I'd like to pick up cube colliders and add them under my Rigidbody affecting the way it rolls.
I have read that there are issues with changing transform parents, but would there be issues with enabling or disabling a pool of cubes (either by changing layers) and then moving them at runtime?
2 Replies
Hi @JimJamesJimJim. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, I can offer some insights on implementing a growing Rigidbody with dynamic colliders using Normcore, while addressing your specific concerns:
1. Changing transform parents:
You're correct that there are issues with reparenting objects that have RealtimeTransform components. According to the RealtimeTransform documentation (https://normcore.io/documentation/realtime/realtimetransform#extra-notes), reparenting game objects with RealtimeTransform is not recommended as Normcore doesn't track or synchronize parent relationships.
2. Dynamic colliders and Rigidbodies:
The RealtimeTransform documentation (https://normcore.io/documentation/realtime/realtimetransform#extra-notes) also mentions that adding or removing Rigidbody components at runtime is not supported. This is because Transform mode and Rigidbody mode work differently under the hood, and it's not easy to transition between them smoothly.
3. Alternative approach:
Instead of reparenting or dynamically adding/removing Rigidbodies, you could consider the following approach:
a. Create a pool of cube colliders as child objects of your main Rigidbody (the growing ball).
b. Keep these cubes disabled or on a non-colliding layer initially.
c. As the ball grows, enable the appropriate cubes or change their layers to make them affect collisions.
d. Use a custom RealtimeComponent to synchronize the state (enabled/disabled or layer) of these cube colliders across the network.
This approach avoids the issues with reparenting and dynamically adding/removing Rigidbodies while still allowing you to affect the ball's shape and collision behavior as it grows.
4. Synchronizing object states:
To synchronize the states of your cube colliders, you'll need to create a custom RealtimeComponent. The RealtimeComponent documentation (https://normcore.io/documentation/realtime/realtimecomponent) provides information on how to create and use custom components to synchronize game state across the network.
5. Rigidbody considerations:
Keep in mind that when using RealtimeTransform with Rigidbodies, it works in world space and has specific behaviors for ownership and collisions, as described in the Networked Physics documentation (https://normcore.io/documentation/realtime/networked-physics#realtimetransform--physics).
In conclusion, while dynamically changing the structure of a Rigidbody object has some limitations in Normcore, you can achieve a similar effect by carefully managing a pool of child colliders and synchronizing their states using custom RealtimeComponents. This approach should allow you to create a growing ball effect similar to Katamari Damacy while working within Normcore's networking framework.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@351655082145611778> Kapa.ai is still learning and improving, please let me know how I did by reacting below.