Unity Community


Results 1 to 12 of 12

  1. Location
    Brisbane, Australia
    Posts
    4

    'Super Mario Galaxy' style gravity simulation

    'lo all, new Unity 3D convert here. I'm relatively new to games design, I'm currently studying traditional comp-sci and multimedia.

    What I'd like to do is build my first attempt at a 3D game on an implausibly small planetoid, similar to the the many-small-planetoids approach used in Super Mario Galaxy. Since the player will be moving all the way around the circumference of the game world, the concept of 'down' can't simply be a negative acceleration along the Y axis, but rather an acceleration towards a particular point (the centre of the planetoid).

    So, my guess is that the one way to simulate this (particularly as I only intend to have a single planetoid for this game at least) would be to have a game-world level script that modifies the X/Y/Z acceleration of objects based on their positioning in reference to the centre point I define.

    Has anyone else attempted this already? Can I use the Physics.gravity property for this? Are there any bugbears I should look out for (especially if I start having multiple rigidbodies falling and hitting each other at the same time, like a rock-slide or similar)?

    Nice to meet you all. I'm looking forward to learning from this community

  2. Administrator
    Location
    Indianapolis, IN
    Posts
    1,070
    Charles Hinshaw


  3. Location
    Luxembourg
    Posts
    658
    There's something like this in the locomotion project...
    http://unity3d.com/support/resources.../locomotion-ik


  4. Location
    Brisbane, Australia
    Posts
    4
    Thanks, all

    Both of these are much easier than the trig script I was tinkering with.

    (note to self: search function exists for a reason. Sorry.)


  5. Location
    Massachusetts
    Posts
    1,796
    Using info from those topics I made a single planet gravity demo. I also made a neat camera script that keeps you in focus, so it looks like the planet under you is rotating.

    I can post it later, not on my Mac right now.
    Try my new Android game Starling Fall (forum thread)!
    And check out my other Android apps


  6. Location
    Luxembourg
    Posts
    658
    Yes, good idea:
    Rotating the planet, not the player!


  7. Location
    Massachusetts
    Posts
    1,796
    Well, I physically rotate the player, but the camera follows the player so it appears that he's still rightside-up. It gives a very cool effect, I think. ;P
    Try my new Android game Starling Fall (forum thread)!
    And check out my other Android apps


  8. Location
    Brisbane, Australia
    Posts
    4
    Yes please!

    That sort of of effect would work very well for my game's perspective I think. Could you post the script?


  9. Location
    Massachusetts
    Posts
    1,796
    Here's the basic camera script:

    PlanetCam.js
    Code:  
    1.  
    2. function Update () {
    3.     transform.LookAt (target);
    4.     transform.position.x = target.position.x;
    5.     transform.position.y = target.position.y;
    6.     transform.rotation = target.rotation;
    7. }
    Try my new Android game Starling Fall (forum thread)!
    And check out my other Android apps


  10. Location
    Brisbane, Australia
    Posts
    4
    Thanks That looks pretty awesome running around a big sphere. Beautiful curved horizon.


  11. Location
    Massachusetts
    Posts
    1,796
    Try my new Android game Starling Fall (forum thread)!
    And check out my other Android apps


  12. Posts
    138
    What I would do is create a standard constant force whose vector varies depending on the position of the object, basically point a ray at the center of the "planet" and apply it as the gravity.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •