How do you spawn an actor and position it relative to the actor?

natclarkenatclarke Brisbane, AustraliaMember, PRO Posts: 243

I have an actor that I would like to put a (spawned actor to create smoke) at the back of the hover bike (see image) . I am not sure what position for x any y axis to use so that it comes out at the back of the hover bike. Is there a method to do this simply?

Nat Clarke
Life Cleansing

Comments

  • ToqueToque Member Posts: 1,188
    edited November 2016

    Spawn x axis. Depending on size of it??
    Experiment. 50 or 100.

    You might have to play with y as well.

    Trial and error. I spawn behind actor.

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

    The most important thing is to set the X and Y positions to "relative to actor." Then, keeping in mind that the actor's X position is at its center, you can find the right edge of an actor by using self.Position.X-self.Size.Width/2. In the case of "relative to actor," you would just enter the expression -self.Size.Width/2. As was mentioned above, you may have to do some trial and error to get the positioning just right (e.g. -self.Size.Width/2+18 or -self.Size.Width/2-5).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.