Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: center of mass and model orientation  (Read 7733 times)

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
center of mass and model orientation
« on: May 29, 2013, 10:59:11 am »

Is it possible to change the position of the center of mass of a vehicle while it's running?

I'd also need to get the orientation of the model in world space. Is geomob.get_rot() what I'm looking for?
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: center of mass and model orientation
« Reply #1 on: May 29, 2013, 11:47:39 am »

center of mass - not yet.

get_rot on the top level object should get you the rotation quaternion from model to world (ECEF) space.
Logged

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #2 on: May 30, 2013, 06:29:11 am »

center of mass - not yet.
Ok. Is it coming any time soon? :)

get_rot on the top level object should get you the rotation quaternion from model to world (ECEF) space.
Mmh... it seems that's not what i need. I'd need a coordinate reference where +z is going from the center of the earth toward space, so -z would actually be the gravity vector.
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: center of mass and model orientation
« Reply #3 on: May 30, 2013, 09:23:04 am »

I think there was an issue with the dynamic center of mass, due to the design of Bullet physics it also moved the collision box, or something like that. Need to look at that again. What are you trying to achieve?

Since we are on a sphere, position of the vehicle is a vector from the center to the vehicle. Normalizing it will give you an up vector. But a single vector doesn't make a coordinate space, so ... what are you trying to achieve? :)
Logged

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #4 on: May 30, 2013, 09:40:35 am »

I think there was an issue with the dynamic center of mass, due to the design of Bullet physics it also moved the collision box, or something like that. Need to look at that again. What are you trying to achieve?

This: :)



To make a bike stand right I need to be able to move the CoM, especially when turning. In real life the driver moves a little left or right to move the CoM in the right position but in Outerra there's no driver. :)
Currently I placed it at z=0, so when I don't turn it doesn't fall but I usually can't make more that 100 meters without it falling.

Since we are on a sphere, position of the vehicle is a vector from the center to the vehicle. Normalizing it will give you an up vector. But a single vector doesn't make a coordinate space, so ... what are you trying to achieve? :)
I haven't fully though how, but I think to move the CoM in the right place I need to know how much the bike leans to the left or right, which is the angle between the model z axis and the gravity vector.
Then there's also the centrifugal force in the play but as i said i haven't given it a full thought, i'm still working on the model.
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

ZeosPantera

  • ||>>-Z-<<||
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2520
  • #1 Outerra Fan Boy
    • My Youtube
Re: center of mass and model orientation
« Reply #5 on: May 30, 2013, 10:55:00 am »

I think the centrifugal forces are really what you need for stability. That would involve wheel mass which isn't in here yet.
Logged
"Fear accompanies the possibility of death, Calm shepherds its certainty" - General Ka Dargo

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #6 on: May 30, 2013, 12:50:36 pm »

Yeah. Also for the conservation of angular momentum, which doesn't do yet, and it's what makes it steer when it leans.

EDIT: Actually, by reading more into bike dynamics the CoM shifting is needed only when you run without hands on the handlebars. Otherwise turning the handlebars is enough to keep it upright.
Still, we're missing the gyroscopic effect and the conservation of angular momentum, but maybe they can be faked...
« Last Edit: May 30, 2013, 04:59:40 pm by giucam »
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #7 on: June 03, 2013, 01:23:45 pm »

I just realized that the angle i need is actually the roll. So yeah, the up vector would be the model position, the forward would be the model forward and the right would be the normal. In that frame when the bike leans on the left the up and next rotate around the forward axis, and that's the angle i need.
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

bugsblake

  • Sr. Member
  • ****
  • Posts: 255
  • jedi master
Re: center of mass and model orientation
« Reply #8 on: June 03, 2013, 01:35:31 pm »

so are you able to get the bike to ride now or still need something? cant wait to see it in action! ;)
Logged
Intel 6 core i7 Xeon - 4930k @3.40 GHz
GTX 770 4GB X2 in SLI
Asus P9X79 Extreme MOBO
Patriot 16GB DDR3 1600MHz
SSD 250GB + SATA 500GB + SATA 1TB

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #9 on: June 03, 2013, 03:07:13 pm »

No, it still needs almost everything. :P It stands, moves and turns but it is highly irrealistic.
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org

bugsblake

  • Sr. Member
  • ****
  • Posts: 255
  • jedi master
Re: center of mass and model orientation
« Reply #10 on: June 03, 2013, 03:18:30 pm »

lol, so we await new engine features! something to look forward to! :D
Logged
Intel 6 core i7 Xeon - 4930k @3.40 GHz
GTX 770 4GB X2 in SLI
Asus P9X79 Extreme MOBO
Patriot 16GB DDR3 1600MHz
SSD 250GB + SATA 500GB + SATA 1TB

M7

  • Hero Member
  • *****
  • Posts: 736
  • newbie
Re: center of mass and model orientation
« Reply #11 on: June 03, 2013, 04:08:32 pm »

I drove a motocycle only once in my teenager time at something like 100 km. I remember i simply didnt know how to turn with this thing at that speed . I thought all i can do is to move my weight to one side to get it turn. Then the owner who was sitting in the back told me that to turn on lets say the right side, i need to push on the right handle. So in a way you have to turn the handles/wheel in opposite direction to initiate the turn in the intended direction.

Wonder if it could be made into game feature (never played a bike sim though)
Logged

bugsblake

  • Sr. Member
  • ****
  • Posts: 255
  • jedi master
Re: center of mass and model orientation
« Reply #12 on: June 03, 2013, 04:15:42 pm »

yes thats right! its called opposite lock! you can see it being done in superbike racing! check youtube vids! :) not sure how that wound work in game though? :/
Logged
Intel 6 core i7 Xeon - 4930k @3.40 GHz
GTX 770 4GB X2 in SLI
Asus P9X79 Extreme MOBO
Patriot 16GB DDR3 1600MHz
SSD 250GB + SATA 500GB + SATA 1TB

giucam

  • Full Member
  • ***
  • Posts: 171
  • It's an ugly pile of bones... like me.
Re: center of mass and model orientation
« Reply #13 on: June 04, 2013, 04:42:16 pm »

So i managed to get the lean angle, by transforming the (0,0,1) vector with the quaternion of the model orientation, projecting it and the model position to the plane with the model's (0,1,0) as normal and getting the angle between the two vectors, but now i'm struggling to make it keep balance.
I can make it stay upright at low speeds by steering into the leaning side, but when going over a certain speed it starts wobbling left and right and touches the ground after some cycles. And i can't find any meaningful resource online...  >:(
Logged
ResidualVM 0.1.1 is OUT! www.residualvm.org