playMaker

Author Topic: HookShot Mechanic Refactoring  (Read 1268 times)

stvbabb

  • Junior Playmaker
  • **
  • Posts: 66
HookShot Mechanic Refactoring
« on: April 02, 2018, 08:24:54 AM »
Hello,

I'm wondering if I could get some help from the community regarding a mechanic that I've been working on. It's a HookShot style mechanic, but it's not using ray casting; rather it's a bit more physical so that it can ricochet off non-hookable objects. I actually did this first in c# with very mixed results, but again, Playmaker and it's wonderful framework really helps me to see what is going on.

Anyway, I think there is some stuff I could be doing better. And, I'm really mixing up world space and self space (or am I?). The HookShot Container is childed to the player character, and the HookShot Bolt is then childed to the HookShot Container. And, throughout my FSM I'm doing some stuff in world space and some stuff in self space. I tried making everything self space and that really didn't work, and then I tired doing everything in world space and that also didn't work. Is this a problem?

If a video would help I can record one as well.

Thanks,
Steve




stvbabb

  • Junior Playmaker
  • **
  • Posts: 66
Re: HookShot Mechanic Refactoring
« Reply #1 on: April 02, 2018, 10:16:24 AM »
I think this actually works better now - but I'm not entirely sure this very optimal.

In the start state I'm now setting the parent of the HookShot Bolt as it's direct parent the HookShot Container which it is already in the hierarchy, and then when I apply force in the ApplyForce State I set the parent of the HookShot Bolt to nothing so it's in world space, and then the player can run around without the Bolt following the rotation of the player. And, when it's back home or back to the Start it's re-parented to the HookShot Container.

I also added a particle system instead of a line renderer, looks much better.

Thanks,
Steve