playMaker

Author Topic: FPS Aiming  (Read 3168 times)

greg

  • Junior Playmaker
  • **
  • Posts: 68
FPS Aiming
« on: April 07, 2013, 04:24:28 PM »
Thinking of having no crosshair in my FPS like in Quake/Doom.
Aiming would need to be really forgiving for this (slight auto-aim)
I'm thinking sphere casting, is there an action for this.


EDIT: maybe something to do with getting WorldToScreenPoint: if dude is close to centre of screen, aim invisible crosshair on him (if more than 1, aim at one who is nearest to screen centre), then ScreenPick which would cast a ray at that dude.

But would this mean using WorldToScreenPoint on every enemy, every frame. Is this expensive, any ideas to optimise?

Cheers guys!
« Last Edit: April 07, 2013, 04:36:16 PM by greg »

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: FPS Aiming
« Reply #1 on: April 07, 2013, 04:37:13 PM »
Stupid solution I would make as a noob: I would place a long box (or a long capsule) in front of camera (or the shooting weapon) and make it a trigger.
When the player fires, it checks if any enemy is in the trigger area.
This way you can easily control the "quantity" of autoaim to give the player.
Very easy, very quick. Probably a horrible solution, but probably the fastest one to implement.
« Last Edit: April 07, 2013, 04:50:54 PM by megmaltese »

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: FPS Aiming
« Reply #2 on: April 07, 2013, 04:54:57 PM »
Stupid solution I would make as a noob: I would place a long box in front of camera (or the shooting weapon) and make it a trigger.
When the player fires, it checks if any enemy is in the trigger area.
This way you can easily control the "quantity" of autoaim to give the player.
Very easy, very quick. Probably a horrible solution.

haha, not a bad solution, just a bit hacky!

Is checking "game object is visible" for each enemy, every frame, a smart solution. And if they are visible, getting their WorldToScreenSpace to check for autoAiming?

Not sure how "is visible" works, or how performance heavy it is.

PolyMad

  • Hero Member
  • *****
  • Posts: 545
Re: FPS Aiming
« Reply #3 on: April 07, 2013, 11:41:09 PM »
Mhh why you don't like my solution?
It's efficient and very quick to set up.

Also: you can just activate the trigger exactly when the weapon fires and then deactivate it.

I was also thinking to a solution to shoot the center-most enemy to the line of fire.
You could set up more triggers, like 3 in example, all centered, with increasing radius.
And start check from the smallest one.
No hit, then check the larger one.
No hit, then check the largest one.

I can't understand why many people don't just use the instruments that Unity offers.

Just asking.

greg

  • Junior Playmaker
  • **
  • Posts: 68
Re: FPS Aiming
« Reply #4 on: April 08, 2013, 08:03:34 AM »
Mhh why you don't like my solution?
It's efficient and very quick to set up.
Just asking.

Other way seems more precise and less bug prone. Feels like "the right tool for the job".

"World to Screen Space" and "is visible" are both tools provided by Unity as well.