Page 1 of 1

Limiting turret and weapon angles

Posted: 24 Sep 2009, 13:43
by Erik
For example if i want a turret to turn only 180 degrees? Or a barrel that can only move up and down a small bit so it doesn't collide with other parts of the unit?
How can this be achieved?

Re: Limiting turret and weapon angles

Posted: 24 Sep 2009, 15:22
by smoth

Code: Select all

  weapons = {
    [1]  = {
      badTargetCategory  = "AIR",
      mainDir            = "0 0 1",
      maxAngleDif        = 210,
      name               = "herobeamrifle",
    },
    [2]  = {
      badTargetCategory  = "AIR",
      mainDir            = "0 0 1",
      maxAngleDif        = 210,
      name               = "45mm",
      slaveTo            = 1,
    },
    [3]  = {
      mainDir            = "0 0.5 1",
      maxAngleDif        = 110,
      name               = "45mm",
      slaveTo            = 1,
    },

Re: Limiting turret and weapon angles

Posted: 24 Sep 2009, 18:17
by Master-Athmos

Re: Limiting turret and weapon angles

Posted: 24 Sep 2009, 18:30
by Gnomre
Keep in mind it's a cone, not really an arc. If you try to limit something to only rotate 10 degrees one way it will also be limited on the other axis as well.

If it's just a visual clipping thing, as long as you don't mind occasional odd-looking shots, you can just use an if pitch > maxdesiredangle then pitch = maxdesiredangle check to force the animation from turning that far. Just make sure you give the weapon enough tolerance then.

Re: Limiting turret and weapon angles

Posted: 13 Apr 2015, 13:29
by 8611