playMaker

Author Topic: Circular gravity method.  (Read 10866 times)

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Circular gravity method.
« on: September 23, 2013, 02:03:42 PM »
First of all, Hi!
 I'm trying to implement a circular gravity like Super Mario Galaxy with first person view. I was looking in this thread to get me started and i've got the gravity working but have a hard time implementing a character that would stand up on the ground. Right now, the character rotates freely on the surface.

http://hutonggames.com/playmakerforum/index.php?topic=1345.0.

Any guide or tips on how I could make this? I've included the FSM asset. The scene has two sphere's. One acting as the planet and the other as the player.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #1 on: September 24, 2013, 06:07:22 AM »
Hi,

 try this:

http://u3d.as/content/lane-max/circular-gravity-force/4tu

http://u3d.as/content/rj-proz/physics-forces-circular-gravity-buoyancy-projectile/4SU

I never tried these, but if I was to do some circular gravity, I would use one of them, as it would be difficult to do this efficiently yourself.

bye,

 Jean

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #2 on: September 24, 2013, 07:09:57 AM »
I've got the gravity working in the scene following the thread mentioned but I'm having hard time making the player stand up on the ground below. Right now it's rotating weirdly. How can I make the player's up vector equal that of the vector that I got back from the raycast using playmaker?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Circular gravity method.
« Reply #3 on: September 24, 2013, 07:37:38 AM »
http://forum.unity3d.com/threads/122385-super-mario-galaxy-gravity

http://forum.unity3d.com/threads/8873-Faux-Gravity-making-my-brain-spin-Help!?

I seem to remember a thread about a super mario galaxy style system being discussed on the unity boards a couple years ago and getting this sort of system figured out, there's a couple threads to start.

I'm not sure if LaneMax's circular gravity script would work properly for what you're doing, it would mean making some sort of secondary control to the player to make sure he stays upright and figures out where "up" is. It would probably be a great start though, its a fantastic and versatile script.

It's probably a matter of figuring out where the center of the gravity is at, then comparing the player position. Maybe you can utilize some sort of LookAt on the -Y axis toward the center of the gravity?
« Last Edit: September 24, 2013, 07:39:18 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #4 on: September 25, 2013, 12:29:22 AM »
I'll try something and update this post. I'm thinking making a child empty gameobject and making it look at the center of the planet and applying that child's rotation to my payer object(parent object). All through playmaker.

Just realized that wouldn't work.
« Last Edit: September 25, 2013, 01:42:13 AM by KomalR »

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #5 on: September 26, 2013, 08:29:58 AM »
I'm not able to get my player's feet to point at gravity's direction. I have got the gravity working following this post by Alex Gravity in the center of planets and for pointing the feet down How Raycast work? How do I make the character's feet face the vector3 direction (gravity here)?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #6 on: September 27, 2013, 01:33:35 AM »
Hi,

 That's going to be tricky... What do you expect after you have aligned it? do you want to still be able to move it around? like is your character on a round sphere or something? or is it just in the air?

bye,

 Jean

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #7 on: September 27, 2013, 04:42:19 AM »
Yes, the player character is going to move around a sphere that will act as the ground.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #8 on: September 27, 2013, 05:16:48 AM »
Hi,

 Then you need to raycast down and get the hit position, which is where your player should stand. raycast also givee you the normal of the hit position which is the direction where the player should be up.

does that help?


Bye,

 Jean

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #9 on: September 27, 2013, 06:13:34 AM »
Well, I know about the normal but it's rotating the player that's the problem. How do I rotate the player around a vector axis?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #10 on: September 27, 2013, 06:36:14 AM »
Hi,

 You make it "look at it", using the look at function. Be careful look at use the forward axis, so you may have to include a dummy gameobject that has its forward axis point up, and attach your player on that.


Bye,

 Jean

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #11 on: September 28, 2013, 10:20:23 AM »
Well, i'll put a hold on this project for now. To complex for my puny brain. Thanks for your help, anyways.. :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #12 on: September 30, 2013, 01:55:01 AM »
Hi,

 Ok, don't hesitate to bump this back even if it's a long time.

bye,

 Jean

KomalR

  • Playmaker Newbie
  • *
  • Posts: 16
Re: Circular gravity method.
« Reply #13 on: January 24, 2014, 12:40:45 PM »
So, I've decided to start my work on this game again. Though, I'm starting from scratch. I've got the gravity working like I wanted.

Here's how I did it. I just rotate the planet as the character moves. So, the only action the player performs is the jump and i'd parent everything else other than the player to the planet, so that it would seems the whole world is moving.

I haven't figured out any flaws with my method but let me know what you guys think.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Circular gravity method.
« Reply #14 on: January 27, 2014, 04:47:25 AM »
Hi,

 Sounds good. That kind of mechanics needs to be tested, so go for it and keep us updated.

bye,

 Jean