Actor pos relative to other actor not working

I want this actor to stay fixed to almost the edge of the corner of the other actor, my file is shown in the video video here:

I have used an attribute to keep the position x and y (+ a bit to get in corner) & rotation to big box

How do I do this?

Cheers

Max

Answers

  • JagonAppsJagonApps Member Posts: 241
    Thanks, I have been trying this out and not 100% sure how to do it...
    from the original 2 equations...
    self.position.x = game.sceneX+magnitude(self.offsetX ,self.offsetY)*cos( self.Rotation )
    self.position.y = game.sceneY+magnitude(self.offsetX ,self.offsetY)*sin( self.Rotation )
    I thought this...

    game.sceneX was for the location of the big square actor's X position
    self.offsetX was the offset in x direction from centre of big square
    * i assume is multiply

    and mine didn't work out quite right...
    did i do it right?

    Many thanks

    Max
  • JagonAppsJagonApps Member Posts: 241
    scrap that I was right, I forgot to turn on referring the rotation to the big box...

    Cheers uptimistik, I would have never worked out what to type into google anyhow!
  • JagonAppsJagonApps Member Posts: 241
    wait one second...sorry to mess anyone around, but I have realised I did get it wrong...what would it be?
  • JagonAppsJagonApps Member Posts: 241
    Yes, I have added you, thanks, although I'm afraid my mic or webcam isn't working, but I should be able to screen share and use chat
  • JagonAppsJagonApps Member Posts: 241
    Just to clear things up for anyone who has seen this post..
    After some very kind help from uptimistik, he deduced that the formula needed to be:

    game.Win lvl box-pos.x +magnitude( self.offsetX , self.offsetY )*sin(( self.Rotation )-atan( self.offsetX / self.offsetY ))

    game.Win lvl box-pos.y -magnitude( self.offsetX , self.offsetY )*cos(( self.Rotation )-atan( self.offsetX / self.offsetY ))

    Thanks again to uptimistik, I recommend everyone to check him out
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @JagonApps and @uptimistik -- I've created some 'new and improved' examples of how to do this. (The formulas you list above are useable, but can be confusing.) Here is a link for a better example:
    http://www.mediafire.com/download.php?nc9rawgb9y3yn5z
  • JagonAppsJagonApps Member Posts: 241
    Thanks RThurman, I'll probably just stick with what I have hot as it is now working perfectly, but may well use this way next time!

    Cheers

    Max
Sign In or Register to comment.