Using gravity with YAxisForward

  • A* version: 5.3.8
  • Unity version: 6.2

My game is a top-down game (think Hotline Miami) which blends 2D and 3D. My movement plane is XY like most 2D games but I have z-depth as well. In my case gravity is set to 0,0,50 (i.e. gravity is on the z-axis).

I am using entityfollowers and would like to use the built-in gravity feature but this is hidden in the inspector if orientation is set to YaxisForward. I tried using a script to enable gravity on Start() but that didn’t seem to have any effect. Is it possible to use gravity with this setup? If not, what alternative do I have? I do have kinematic rigidbodies on my AI - should I make them dynamic and enable gravity that way? I’d hesitate to do this as I wouldn’t want to fight w/ A*s built in systems.

Hi

I would recommend using ZAxisForward, but rotate the agent in 3D space so that it is like looking down on a normal 3D character.

The FollowerEntity’s gravity will always be applied in its local down direction. But it is hardcoded to use Physics.gravity.y as the value for that, I’m afraid.

Hey Aron, so it sounds like no matter what the gravity will be implemented in the y-axis alone? Any chance to get making that more flexible added to the feature list :-).

Gravity will always be in the down direction of the agent (it’s local Y axis). So if you rotate the agent, gravity so that its local Y axis is along the Z axis, then gravity will work in the Z axis. It will always take the gravity value from Physics.gravity.y, though.