Spawners, parenting and rotations

edited September 2015 in Help request
Interesting issue:

I have an alien object, a spawner attached, which shoots alien bullets:

[AlienObject]
Graphic         = AlienGraphic
Rotation        = 0 ~ 360
Position 	= (0,10,0) ~ (800, 10, 0)
UseRelativeSpeed= true
Body            = AlienBody
Spawner		= AlienBulletSpawner


[AlienBody]
PartList        = AlienBodyPart

[AlienBodyPart]
Type            = box

[AlienBulletSpawner]
Object          = AlienBulletObject
WaveSize        = 1
WaveDelay       = 1
Position        = (0, 0, 0)
;UseRotation = true
;UseRelativeSpeed = true
UseSelfAsParent   = true

[AlienBulletObject]
Graphic 	= AlienBulletGraphic
Speed           = (0, 250, 0)
LifeTime        = 2
Body		= AlienBulletBody (not listed)
;UseParentSpace = true


Using "UseSelfAsParent = true" in the AlienBulletSpawner almost does what I want, which is to have the bullet shoot in the direction that the alien is facing.

But because the bullets are now true children of the parent, as the alien spins, the bullets continue to circle around the parent.

What I want to do is have the bullet take the rotation and position of the spawner, then go on their merry way in the last known direction the spawner was facing.

I tried conbinations of:
UseRotation = true
UseRelativeSpeed = true

...for the spawner, and while they inherited the rotation, the direction/speed vector was not used. (0, 250, 0) is always used.


Tried "UseParentSpace = true" on the bullet object, but no improvement.

UseRelativeSpeed = true spanwer doc states: "If true, speed will be applied relatively to current spawner rotation & scale."

Anyone got ideas here? Is this a bug?

Comments

  • edited September 2015
    The spawner properties of UseRotation/UseRelativeSpeed is definitely what you want.
    However, you also need to override the object's speed at the spawner level with the ObjectSpeed property, which is the part I think you're currently missing.
  • edited September 2015
    How about a timeline track!
    [DetachImmediatelyTrack]
    0 = > Object.GetSpeed ^         #
        Object.SetSpeed ^ < true    #
        > Object.GetPosition ^ true #
        Object.SetPosition ^ <      #
        > Object.GetScale ^ true    #
        Object.SetScale ^ <         #
        > Object.GetRotation ^ true #
        Object.SetRotation ^ <      #
        Object.SetParent ^
    
    [Spawnee]
    Tracklist = DetachImmediatelyTrack
    

    So, the point is you get all the global properties and then set them as local properties and then detach from the parent.
  • edited September 2015
    How about using object.attach / object.detach in that case? ;)

    Speed shouldn't be necessary though, as detaching the object shouldn't alter it, ie. speed is always stored globally internally.
  • edited September 2015
    Works for me :) I'm just exercising my new habit of approaching every problem by saying "How would iarwain use timeline tracks to solve this problem?" :)
  • edited September 2015
    Yes it seems spawners or tracks... either or works.

    I am trying to think from an educational/beginner's point of view which is the more straight forward.

    I have tracks replacing some spawners where it is so incredibly simple, but in the case of a rotating shooting object, a spawner seems easier and more configurable.
  • edited September 2015
    sausage wrote:
    Yes it seems spawners or tracks...
    I actually meant using them together. Use a spawner to spawn the bullets as children, then use a timeline track to detach those children immediately at creation while retaining their scale and translation they inherited from their parent.
Sign In or Register to comment.