playMaker

Author Topic: Change Game Object pivot point  (Read 4832 times)

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Change Game Object pivot point
« on: December 22, 2013, 05:09:55 AM »
Hi again.

I'm wondering if there's a way to change the pivot point of an object at runtime.

Here's a simple example. Imagine a square door that opens along a hinge then closes. When it opens again, it doesn't oepn from the hinge on the left, but now it opens from a hinge on the right. When it closes again, it opens from a hinge on the top.

Can I do this strictly in PM or will this take a bit of coding to do? Thanks.

cloud03

  • Full Member
  • ***
  • Posts: 249
  • Viva Playmaker!
    • Milkish Game Studios Blog
Re: Change Game Object pivot point
« Reply #1 on: December 22, 2013, 05:38:04 AM »
well you could create 3 different empty gameObject, and position it according to those different hinges, and switch the door parenting to those 3 different empty GameObject via fsm, and rotate the gameObject....

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Change Game Object pivot point
« Reply #2 on: December 22, 2013, 08:28:30 AM »
 Gotta reparent it to different objects or use animations. For most cases people only need to do it once so the wrapper object idea works fine but in your case you probably want to use different animations to keep it simple.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

ViRiX Dreamcore

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Change Game Object pivot point
« Reply #3 on: December 23, 2013, 04:41:46 AM »
Thanks for the replies guys!

Yeah, after HOURS of figuring out how to rotate it with the iTween rotate To, I got it to rotate around one parent, but with multiple parents and different hinges, it just started flipping everywhere.

I'll try it with different rotation animations and having it just aline to where I need it to go. . .

Also, is there an action to simply make something rotate a certain number of degrees on one or more axis regardless of where the corrent rotation is?

Like regardless of what the axis is, it adds 180 degrees to the Z access. Everytime I try to use Rotate To or From or any of those, it keeps looking at all the axi. ... Do you think simply adding a vector3 to the rotation vector will do this?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Change Game Object pivot point
« Reply #4 on: December 23, 2013, 07:49:13 AM »
Here's an example.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D