• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

FPS Targeting

Status
Not open for further replies.
Level 3
Joined
Feb 25, 2007
Messages
22
Hey, so like basically everyone else I'm working on a little FPS to get used to the Galaxy Editor, but I'm having some trouble with the targeting system. As it works now, WASD alters a global Real which the character then turns to (this is so a unit that is walking forward will not have to stop to turn). Also, this allows the camera to remain facing forward when the character strafes.

For my weapon system, I spawn a unit and order it to move to a point (position of the character) with polar offset (towards camera facing degrees) so that when strafing you can still fire forward. Collision of bullets is working fine, but the targeting is terrible. Even though the camera/movement works perfectly, the bullets often fly in completely random (or at least as far as I can tell) directions. Sometimes it seems as if they are all attracted to a particular point, but that point changes often.

Anyways I was wondering if anyone had any ideas on what's going wrong and how to fix it. I can put up some of my triggers if that'll make it easier, and any help is appreciated.

Thanks!
 
Level 20
Joined
Jan 6, 2008
Messages
2,627
Thats because the pathing area is not walkable, you need a peridiodic timer to order him to move abit for per 0.05 second instead of choosing an unwalkable way

EDIT
example

  • ShootLoop2
    • Events
      • Timer - Every 0.05 seconds of Game Time
    • Local Variables
      • UG = (Units in (Weapon - Banshee units in (Entire map) owned by player Any Player matching Excluded: Dead, Hidden, with at most Any Amount) owned by player 1, with at most Any Amount) <Unit Group>
      • U = No Unit <Unit[2]>
    • Conditions
    • Actions
      • Unit Group - Pick each unit in UG and do (Actions)
        • Actions
          • Unit - Order (Picked unit) to ( Move targeting ((Position of (Picked unit)) offset by 5.0 towards (Facing of (Picked unit)) degrees)) (Replace Existing Orders)
          • Variable - Set U[1] = (Picked unit)
 
Level 3
Joined
Feb 25, 2007
Messages
22
Thanks guys,
I managed to fix it with a While loop that constantly reminds the bullets to move forward in their given direction. Seems to be working fine
 
Status
Not open for further replies.
Top