playMaker

Author Topic: Creating a fake character turning system (like The Ultimate Doom)  (Read 443 times)

Bipolar

  • Playmaker Newbie
  • *
  • Posts: 49
    • View Profile
Hi, I trought if it is possible, using LookAt, check the look at angle and project a different sprite.

Did you play Ultimate Doom and Doom II?

The character sprite "fake rotation"should change based on where the player is and where actually the enemy is looking at.

https://www.youtube.com/watch?v=cqqrfcBhWzs

How can I do this?

Thanks.
« Last Edit: May 06, 2018, 12:13:13 AM by Bipolar »

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 989
    • View Profile
    • Fat Pug Studio
Re: Creating a fake character turning system (like The Ultimate Doom)
« Reply #1 on: May 09, 2018, 02:49:58 PM »
This is a great question, i love the way old school FPS's were made.

You need two objects (actually three, i'll mention third one later), a child and a parent. One will be used to do everything the enemy is supposed to do as well as measure the angle (transform rotation), while the other one will use the LookAt and display the image based on the angle received.

Imagine looking at the enemy from birds perspective, the rotation of the enemy will actually represent the angle. Depending on the number of sprites you want to use, you will split the states accordingly. If you are using four sprites, it's 0-90, 90-180, 180-270, 270-360. I propose doing one more thing - adding another child that will serve as a point the sprite holding object will be looking at, placed just a bit outside so it rotates with the enemy.

There's a small problem though, ss you know, if the enemy keeps rotating in one direction, rotation will go under 0 or above 360, so i advise using quaternions :)