smashthewindow Posted September 17, 2012 Share Posted September 17, 2012 Watching this video just gave me a great idea I want to prototype: I was thinking if it was possible to change the orientation of the character entity in Leadwerks. Another solution is to just change the orientation of everything else other than the player, but I want to consider all my options before doing something stupid. Any help on this? Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
Canardia Posted September 17, 2012 Share Posted September 17, 2012 Like I have said always, use a pivot to mark the gravity center, and don't use Newton's own gravity at all, it just doesn't work (especially with airplanes and composed multi-part bodies you will see that it just goes nuts). When you have the pivot gravity positioned, make a loop which adds forces to all objects towards the gravity center. That way you can also change the direction of gravity in any direction you want by just moving the gravity pivot. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
smashthewindow Posted September 17, 2012 Author Share Posted September 17, 2012 Like I have said always, use a pivot to mark the gravity center, and don't use Newton's own gravity at all, it just doesn't work (especially with airplanes and composed multi-part bodies you will see that it just goes nuts). When you have the pivot gravity positioned, make a loop which adds forces to all objects towards the gravity center. That way you can also change the direction of gravity in any direction you want by just moving the gravity pivot. I have no problem with the Newton's gravity, I'm not making an flight simulation game. I'm asking whether the controller entity is rotatable. Quote Blog & Portfolio Current project: moon.chase.star Link to comment Share on other sites More sharing options...
Canardia Posted September 17, 2012 Share Posted September 17, 2012 It's not. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Mumbles Posted September 17, 2012 Share Posted September 17, 2012 don't use Newton's own gravity at all, it just doesn't work (especially with airplanes and composed multi-part bodies you will see that it just goes nuts). There is no default gravity in Newton. Real Newton that is, Likewise, it's also possible to adjust the mass matrix, which I assume would make gravity work correctly for a plane. void ApplyGravity(const NewtonBody * body, const Entity * ent) { float * NewForce = (float*) malloc(3 * sizeof(float)); NewForce[0] = 0.0f; NewForce[1] = GRAVITY_FORCE * ent->GetGravityMultiplier(); NewForce[2] = 0.0f; NewtonBodyAddForce(body,NewForce); free(NewForce); } //callback signature provided by Newton. Most of this code is just copied straight from the tutorial... because it works. void ApplyForceOnlyCallback (const NewtonBody * body, dFloat timestep, int threadIndex) { Entity * ent = (Entity *) NewtonBodyGetUserData(body); dFloat Ixx, Iyy, Izz, mass; NewtonBodyGetMassMatrix (body, &mass, &Ixx, &Iyy, &Izz); TVec3 ForceToAdd = ent->GetForce(); TVec3 InternalForce = ent->GetSelfForce(); TVec3 CombinedForce = GetCombinedForce(ForceToAdd,InternalForce); ApplyForce(body,ent,CombinedForce); if(ent->GravityEnabled()) { ApplyGravity(body,ent); } ent->ClearForces(); } Of course, I never touch the mass matrix because it works fine for me, and messing about with things I don't know could, well, cause planes to fall out of the sky... But really, it should just be a case of modifying Ixx, Iyy and Izz. Don't ask what to though, because I don't know... Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
Daimour Posted September 18, 2012 Share Posted September 18, 2012 There is function SetWorldGravity for changing gravity vector. But concerning controller, I doubt It can be rotated. But who knows... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.