Diablo Style

Discussion in 'How Can I...?' started by Bluemusic, Jan 29, 2021.

  1. Bluemusic

    Bluemusic Boxer

    Joined:
    Apr 7, 2020
    Messages:
    59
    Likes Received:
    10
    Hi
    With camera locked in one position how can I spawn a bullet from an actors gun in the direction the actor is facing? Think Diablo style 3D gameplay and moving the actor around facing all directions.
    The camera is locked and doesn´t follow the actor.

    I have tried using follow rotation on bullets but didnt work. I think I need to have a move node on bullets but as long as you set a direction it will move in that direction even the spawner is a child of the actor.

    Help appreciated. I guess there is more people than me who wonders:)
     
  2. Nicki

    Nicki Boxer

    Joined:
    Feb 26, 2020
    Messages:
    9
    Likes Received:
    9
    Hi there.
    Funny enough I was trying this same thing last week.
    This was my solution, in the child bullet spawner you mentioned above you will have to edit the spawner script to take the rotation of the parent. (The actor).
    The reason is because there is no way to get the worldRotation of the child entity.

    Look for this code in the Spawn script and notice the code change to parent().
    Code:
            if (!this.attribute('Ignore Rotation')) {
                let rot = this.entity().parent().rotation();
                ent.setRotation(rot.x, rot.y, rot.z);
            }
     
  3. Nicki

    Nicki Boxer

    Joined:
    Feb 26, 2020
    Messages:
    9
    Likes Received:
    9
  4. Bluemusic

    Bluemusic Boxer

    Joined:
    Apr 7, 2020
    Messages:
    59
    Likes Received:
    10
    Thanks for the reply! It kinda worked. It did the job but sometimes it shots in the wrong direction. Backwards. Seems like it does when my character is facing left. Forward, backwards and right works fine but as soon as I am facing left it sends out some shots in the opposite direction. Any clues?
     
  5. Nicki

    Nicki Boxer

    Joined:
    Feb 26, 2020
    Messages:
    9
    Likes Received:
    9
    It is difficult to say but could it not be the physics collision shape of character and bullet that interferes with each other?
     
  6. Bluemusic

    Bluemusic Boxer

    Joined:
    Apr 7, 2020
    Messages:
    59
    Likes Received:
    10
    Just check it and its not. Weird. I works 100 percent except if the character is in a special angle. Point is that the character is actually not moving its shape as its a car...I have no clue.
     

Share This Page