Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Rigidbody instantiated on very fast moving object

Discussion in 'Physics' started by Spartan_Boy, May 21, 2017.

  1. Spartan_Boy

    Spartan_Boy

    Joined:
    Jul 8, 2012
    Posts:
    38
    Hello everyone, i'm having a problem on pooled rigidbody projectiles on a very fast moving object. If t stay put and shoot everything works fine: the projectiles shoot far away and hit their target but as soon as i move quite fast or fall the projectiles fly away backwards or upwards respectively. How should i fix it ?
    Should i leave the physics behind and code it differently or is there a proper way to fix it keeping the physics intact ?
    THX a lot.
     
    Last edited: May 21, 2017
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    make sure you reset the velocity/torque/rotation to zero for pooled projectiles when you return them
     
  3. Spartan_Boy

    Spartan_Boy

    Joined:
    Jul 8, 2012
    Posts:
    38
    JamesLeeNZ, thk you very much for your answer, i will certainly make sure of that, though it seems the projectiles fly away even the first time i use them, according to the speed of the vehicle.
    THX
    [...]

    I found a solution by symply cranking up the projectile's speed (which was ignoring my tag or object collisions at that speed) and deactivating a lot of the the layer collision matrix in the physics project settings to be able to get my collision detection back ;-) !
     
    Last edited: May 22, 2017
  4. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    fair enough. Always hard to know for sure without knowing full details of forces etc. I was considering you may need to add vehicle speed into force, but Ive never had to do that myself