View topic - Limiting turret and weapon angles



All times are UTC + 1 hour


Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: 24 Sep 2009, 12:43 
User avatar

Joined: 20 Aug 2009, 19:49
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?


Top
 Offline Profile  
 
PostPosted: 24 Sep 2009, 14:22 
Content Developer
User avatar

Joined: 13 Jan 2005, 00:46
Location: ModalitÃ
Code:
  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,
    },


Top
 Offline Profile  
 
PostPosted: 24 Sep 2009, 17:17 

Joined: 27 Jun 2009, 00:32
Location: Germany
http://springrts.com/wiki/Units:WeaponMainDir


Top
 Offline Profile  
 
PostPosted: 24 Sep 2009, 17:30 
Imperial Winter Developer

Joined: 06 Feb 2005, 13:42
Location: Indianapolis
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.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.