Jump to content

Physics spawner bug


Matmalm

Recommended Posts

Using GeNa 3.4.0 and Unity 2021.3.6

 

When spawning an object with the physics decorator attached, all of the objects in my scene that have a rigidbody are also affected. Their positions and rotations are changed.

 

I think this is very critical, as at least for me it messed up many things in my scene, and I realized too late.

 

 

How to reproduce it:

- Create an object 'a' with a rigidbody (not kinematic) and place it in the scene
- Apply a GeNa Physics decorator to another prefab object 'b'
- Add it to a GeNa spawner
- Spawn it

- Select the object 'b' where you added the rigidbody

 

It will have another position and rotation

Link to comment
Share on other sites

2 hours ago, Matmalm said:

Using GeNa 3.4.0 and Unity 2021.3.6

 

When spawning an object with the physics decorator attached, all of the objects in my scene that have a rigidbody are also affected. Their positions and rotations are changed.

 

I think this is very critical, as at least for me it messed up many things in my scene, and I realized too late.

 

 

How to reproduce it:

- Create an object 'a' with a rigidbody (not kinematic) and place it in the scene
- Apply a GeNa Physics decorator to another prefab object 'b'
- Add it to a GeNa spawner
- Spawn it

- Select the object 'b' where you added the rigidbody

 

It will have another position and rotation

Thanks for reporting this issue. 

I'll investigate promptly.

Link to comment
Share on other sites

3 hours ago, Matmalm said:

Using GeNa 3.4.0 and Unity 2021.3.6

 

When spawning an object with the physics decorator attached, all of the objects in my scene that have a rigidbody are also affected. Their positions and rotations are changed.

 

I think this is very critical, as at least for me it messed up many things in my scene, and I realized too late.

 

 

How to reproduce it:

- Create an object 'a' with a rigidbody (not kinematic) and place it in the scene
- Apply a GeNa Physics decorator to another prefab object 'b'
- Add it to a GeNa spawner
- Spawn it

- Select the object 'b' where you added the rigidbody

 

It will have another position and rotation

Okay, so after a thorought investigation I've found that we have designed this system to work this way intentionally whereby objects can be effected by objects that you have just spawned.

However, I can now see the use case where it would be useful to control the ability to not affect any existing rigidbodies. Unfortunately it is a big job to implement this so I'll try and see if I can put it on my development list for future updates. 

For now, as a workaround, you would have to manually set all objects you don't want effected to Kinematic (in 3D) or disable Simulation (in 2D) before spawning.

Link to comment
Share on other sites

18 hours ago, Manny said:

Okay, so after a thorought investigation I've found that we have designed this system to work this way intentionally whereby objects can be effected by objects that you have just spawned.

However, I can now see the use case where it would be useful to control the ability to not affect any existing rigidbodies. Unfortunately it is a big job to implement this so I'll try and see if I can put it on my development list for future updates. 

For now, as a workaround, you would have to manually set all objects you don't want effected to Kinematic (in 3D) or disable Simulation (in 2D) before spawning.

Al right, there could be a warning about this.

In my case I have many rigidbodies (kinematic and non kinematic) which would be a little time consuming making them kinematic and then reverting them.

Link to comment
Share on other sites

I would make a script, to control this, it would be a simple one to turn on and off..  This would save the time needed. 

 

    rb.isKinematic = false;  you could set it by  tag, or name.  Have them be set based on what ever it is you want them to be and have them revert back.  Add all of the objects you want this to happen to, and tag, them or use a name. You could toss them in a list as well.  

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
On 11/11/2022 at 4:38 PM, Recon said:

I would make a script, to control this, it would be a simple one to turn on and off..  This would save the time needed. 

 

    rb.isKinematic = false;  you could set it by  tag, or name.  Have them be set based on what ever it is you want them to be and have them revert back.  Add all of the objects you want this to happen to, and tag, them or use a name. You could toss them in a list as well.  

 

 

 

Thanks for that suggested fix @Recon! 🙂 

 

@Matmalm keep us posted on whether this workaround applies to your needs.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...