Search Unity

Grenade physics

Discussion in 'Game Design' started by Not_Sure, Aug 6, 2018.

  1. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,546
    I'm struggling to get the physics down for my grenade launcher.

    I'm wanting to get something close to quake:


    But as of right now the grenades tend to cling to the ground and roll. They don't stop. Also, I've got telescoping every other shot.

    I'm currently using a sphere collider and here's the setup for my physics:
    Dynamic Friction: 0.75
    Static Friction: 1
    Bounciness: 0.25
    Friction Combine: Multiply
    Bounce Combine: Maximum

    Any suggestions?
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,619
    At a guess I would say increasing angular drag would be useful to cut down on the roll. Or you could leave it as-is, and have a script that reduces angular velocity after collisions.

    What is "telescoping"?
     
    YBtheS likes this.
  3. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    966
    Could you just not use the physics engine at all? Usually when I want exact control over how something behaves, I script it myself.

    I'd move it in the Update function and do a raycast to determine whether or not it's current path is clear. If it hits something, I'd do a Vector3.Reflect on it's trajectory to bounce it off of a wall (as well as reduce it's speed.) I have a weapon that works very similarly to the Quake grenade launcher and that's how I did it.

    Personally, I'd be concerned about the size of the physics objects anyway for grenades. I'd think it' be quite easy to accidentally toss one though a wall. Unless you use continuous collision, which is expensive.
     
    Martin_H likes this.