Issue With Move Node And Gravity

Discussion in 'BBNodes' started by PunkPuffin, Apr 23, 2019.

  1. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    I believe there is a an issue with the Move Node when Physics is enabled on the Asset.

    If you enable physics on your asset and apply a Move node and set your asset to move say in the -Z direction with for example 0,0,-5 for the speed you will notice that gravity no longer works.

    I believe this bit of code

    Code:
                let vel = phys.linearVelocity();
                vel.x = speed.x != null ? speed.x : vel.x;
                vel.y = speed.y != null ? speed.y : vel.y;
                vel.z = speed.z != null ? speed.z : vel.z;
    Should read like this.

    Code:
    let vel = phys.linearVelocity();
                vel.x = speed.x != 0 ? speed.x : vel.x;
                vel.y = speed.y != 0 ? speed.y : vel.y;
                vel.z = speed.z != 0 ? speed.z : vel.z;
    Once you do this gravity works again.
     
  2. Snozzberry

    Snozzberry Avid Boxer

    Joined:
    Apr 9, 2019
    Messages:
    103
    Likes Received:
    62
    Thank you so much for posting this. I was so confused why it worked before and it didn't now. I have been racking my brain. I thought maybe I did something to jack up the code. Again, thank you. -Shawn

     
  3. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    No problem. Glad it helped you out

    Have a look at some of the nodes I’ve posted you might be interested in those too
     
    itzonator likes this.
  4. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Thanks for this. I was pulling hair out why gravity just stopped working once physics were enabled.
     
    PunkPuffin likes this.
  5. Hamish

    Hamish Boxer

    Joined:
    Apr 1, 2018
    Messages:
    1
    Likes Received:
    1
    I also want to add my thanks! Had the same problem, made the same change to the code and it now works, thank you!
     
    PunkPuffin likes this.
  6. Snozzberry

    Snozzberry Avid Boxer

    Joined:
    Apr 9, 2019
    Messages:
    103
    Likes Received:
    62
    I thought this would be fixed in the final release. Why does it still happen by default? Does anyone else experience this?
     
  7. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    Yup. It wasn’t fixed
     
  8. k0rzun1n

    k0rzun1n Administrator Staff Member

    Joined:
    Jun 3, 2019
    Messages:
    4
    Likes Received:
    5
    To anyone stumbling across this in the near future.
    It's not a bug, it's a feature (obscure though).
    If you don't wan't to set value to some velocity axis, you should leave its field empty.
    When you are setting it to 0 the node actually sets that part of the velocity to 0 (thus overriding the gravity if you set Y-value).
    We are working on better UI and better docs to make this less confusing.
     
    spicedbeangames and PunkPuffin like this.
  9. PunkPuffin

    PunkPuffin Avid Boxer

    Joined:
    Sep 27, 2018
    Messages:
    285
    Likes Received:
    195
    Yes I tried all sorts none, null etc but never empty. There you go.

    I found out about the blank on the recent tutorial video

    Thanks for the info @k0rzun1n
     

Share This Page