How to Record Position of an Actor

agbeyeidagbeyeid Member Posts: 18

I need to help record the position of actor so I can spawn another actor when the first actor gets to a particular position

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Create two real game attributes and name them positionX and positionY. Inside your actor that you want to monitor, use two constrain attribute behaviors to constrain positionX to self.position.X and positionY to self.position.Y.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited August 2017

    Another option is to just check the position within the actor since you already have access to its self.Position.X (and Y) attributes:

    When attribute self.Position.X = ___ AND attribute self.Position.Y = ___
         Spawn actor [actor name]

    Keep in mind that depending on how you are moving and stopping the actor, the rule conditions may not ever be true (e.g. self.Position.X might end being 249.988 instead of 250). You can also use ≤ or ≥ in a rule condition. Or you can round the attribute to a whole number... lots of ways to skin this turkey.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    A third option would be to place an invisible actor at the particular position and use this to trigger the spawn once the other actor collides with it.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @jamie_c Even better!

  • agbeyeidagbeyeid Member Posts: 18

    Thanks for the suggestions.

Sign In or Register to comment.