playMaker

Author Topic: Building a hovercar prefab for racing game [SOLVED]  (Read 6125 times)

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Building a hovercar prefab for racing game [SOLVED]
« on: January 02, 2013, 04:55:13 AM »
Hi all, i was putting together a small game for some prototype fun
A hover racing game with powerups

I've been trying a few strategies on how to build the FSM's but there are so many things im not sure what would be ideal
I'm thinking of having a short raycast and if it hits the terrain it would align and 'grip' onto it, angling the mesh to the terrain

but I'm thinking that might be to specific for a simple arcade style game
controls are simple, forward, stop, turn left, turn right and activate power

Ideas? how would you do this?
« Last Edit: January 03, 2013, 05:39:59 AM by digimbyte »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Building a hovercar prefab for racing game
« Reply #1 on: January 02, 2013, 05:54:47 AM »
Hi,

 Do you have already a moving car without any force feedback? cause a hovering car is only interacting with its environment with counter forces. so yes, the idea of raycasting is a good starting point.

raycast and get the distance from the ground, use the distance as a multipler for a force you apply back to the car, that's your basic idea, then you need to tweak that force with a multiplier so you can really get the desired result. Be prepared for some "nice" suprise, hovering especially for a race car will likely take a lot of tweaking and research to achieve the right handling.

I think the angling of the mesh would be actually controlled by the user as he turns, you always raycast straight down relative to the mesh, not the world, It could have a good effect as you turn ( the car will engage more and more as you turn I think)

Keep us updated on your progress :) always wanted to build one day WipeOut.

bye,

 Jean

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Re: Building a hovercar prefab for racing game
« Reply #2 on: January 02, 2013, 06:33:40 AM »
haha, true, however i think the hovering effect is more for anesthetics then actually hovering
but as of yet, no, i don't even have a car moving, at best i got an object/sphere with an empty object as an anchor and a mesh object inside that

the idea is to build an arcade style racing game with hills, tunnels and jumps, the problem im finding is keeping the car on the ground most the time while applying force from acceleration, like the old style N46 racing games
rigid body isn't liking 'force' when its on the ground
so i may have to use a raycast, but im not sure how i would add a force from underneath while its going up hill...
i see it just flipping the vehicle or making it slide back

ill have to play around with it, let me know if you come up with something?

EDIT: im playing with wheel physics, a wheel in the middle of the car, simular to a unicylce...
im getting some weird results, maybe i need more?
« Last Edit: January 02, 2013, 06:48:34 AM by digimbyte »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Building a hovercar prefab for racing game
« Reply #3 on: January 02, 2013, 06:47:27 AM »
Hi,

 if it's simply for "effect", have your track mesh invisible and at the height you desire, and your car will rest on it as if it was floating.

 Add on top of that a normal car driving system and you are good I would say.
 
One other thing I would explore is using a physics box that I control, and attached to it a spring with the car mesh attached to the other end, you would get a kind of hover effect indeed, something to play around with as well. you could also investigate a "smooth follow" system on the same principle.

bye,

 Jean

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Re: Building a hovercar prefab for racing game
« Reply #4 on: January 03, 2013, 05:39:37 AM »
I looked into it and i realized i was over thinking it from the start, as i broke down and looked at all the processes, i realized all i needed was a cube or sphere to slide over the terrain, add force instead of translate to imitate acceleration and add drag to create deceleration

what i did was edit the unity input manager and use get axis and applied force to a vector then manually rotate it

its not finished but here is the prefab and im quite happy with it, all it needs is a floating animation applied to the anchor

Feel free to use the craft as you see fit and tweak it as you desire

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Building a hovercar prefab for racing game [SOLVED]
« Reply #5 on: January 03, 2013, 06:23:51 AM »
Hi,

 There you go :)

You should mention when it's not obvious that it's a unity 4 package, and also it will require a windows computer as it relies on a 3ds file for the mesh, and on mac, for some obscur reasons, it can not read 3ds files, only fbx.

bye,

 Jean

digimbyte

  • Junior Playmaker
  • **
  • Posts: 52
Re: Building a hovercar prefab for racing game [SOLVED]
« Reply #6 on: January 03, 2013, 10:33:07 AM »
i might have to export them to an FBX if i release it, or just delete the model from the package
shouldn't be any issue with backwards compatibility but that's probably unity's fault, haven't tried importing to 3x