No announcement yet.

Gravity and Cylindrical Terrain

  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by Makaze View Post
    Why make it that complicated? If all of your units are simply walking on the "ground" along the inner surface of the cylinder then they are a fairly constant distance from the axis of rotation. You simply need a unit vector to the nearest point on the axis and scale it by whatever arbitrary (or carefully pre-calculated) value you've decided that gravity is.

    An arbitrary point on the axis with the pawns current Y coordinate substituted in (assuming the cylinder axis of rotation is the Y world axis) gives you the nearest point. If your axis is the world Y axis then you can even use the origin as your arbitrary point since the axis will pass through it. Meaning you don't even need to do any calculations, just kill the Y component from the pawns location and normalize the result for your unit vector to the nearest axis point. Rotating actors smoothly each tick from that info is not difficult.
    Trust it from someone who has actually implemented it - you'll encounter catch, after catch, after unexpected behaviour, after catch. Just try and get it working yourself, and you'll see just how time consuming it is to get it working in a limited fashion, let alone very smoothly