YouGroove Posted February 21, 2014 Share Posted February 21, 2014 I tested LE3 FPS game and the character physics controller has some visible physic jittering. (i put camera a little outside character and put visible material for character) But when you walk, the model weapon and camera are smooth, only the character controller is doing physic jittering problem. I would wish to know if someone could explain why camera is smooth and not jittering like the character controller ? What is the line of code that smooth camera when camera goes forward or turn without jittering like the character physics ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted February 21, 2014 Share Posted February 21, 2014 I haven't looked at it but any time you see Math:Curve() it's smoothing things out. Read what it does: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/math/mathcurve-r602 It basically will lag behind a little and "slowly" catch up to where it should be. The higher the last parameter the longer it'll take to catch up to where it should be, the smoother it'll be though. I have this same issue with my bomb game. However, I don't have it with another 3rd person project. I have to figure out what is different. 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 21, 2014 Author Share Posted February 21, 2014 Ok, as i took your code example, that means that we have both some problem with character controller and TPS. Perhaps it's camera handled differently on your other project where all is ok ? Or perhaps you used another system or functions or some smoothing ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 21, 2014 Share Posted February 21, 2014 I think its normal behaviour. Keep in mind that you watching visual interpretation of physics body, exposed as a wireframe trough renderer, while at same time renderer and physics update, ticking on a different way, what you see as a difference on rendering interpretation side, while physically, its all fine as your camera/characters, moving just fine. I believe, that behaviour is normal thing to see. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 21, 2014 Author Share Posted February 21, 2014 Well, it's character jittering is very visible when the TPS cam is really near player And LE3 FPS demo is smooth camera. Like Rick said , it must come from the code because he has not that problem on another project also a TPS. I think it's positionning code not done in the better way or not where it should be. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Tim Shea Posted February 21, 2014 Share Posted February 21, 2014 If you watch the value of the y coordinate for your character controller, you'll see that it is bouncing very slightly on the ground. This is common for many physics engines, although most will have a damping property that can reduce the effect if it's undesirable. Since we don't have a damping property, we can implement our own by using a pivot for the actual character controller and then applying a smoothed transform to the model. Obviously, the model should then have no physics shape itself. You will have to play with the smoothing factors, but it is possible to have a perfectly smooth first person or third person controller in Leadwerks. For my characters, I'm smoothing both the character controller motion and the camera offset, because the mouse pitch bypasses the character and can cause unappealing stutter as well. Edit: In fact, on a more general note, smoothing out just about any parameter will tend to give nicer looking results, from physics to animations to sound. In real life, everything happens over time, so things that occur without any transition in games tend to stand out. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 22, 2014 Author Share Posted February 22, 2014 so you make a pivoy and attach char controller to it, than attach as child of pivot the character model ? would you have the smoothing lines of code ? or small example ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Tim Shea Posted February 22, 2014 Share Posted February 22, 2014 No, you can't make the model a child of the pivot, because it will inherit all those little bounces from its parent. You have to manually copy the smoothed transform. My position code is sort of complicated because of some other objects, but this is how I smooth the camera orientation. Variables prefixed with an m are member variables. // Calculate the mouse movement Vec3 center = Vec3(context->GetWidth() * 0.5, context->GetHeight() * 0.5, 0); Vec3 delta = Vec3(window->GetMousePosition().y - center.y, window->GetMousePosition().x - center.x, 0) * mLookSpeed; mAngularVelocity = delta * mSpringFactor + mAngularVelocity * (1 - mSpringFactor); mOrientation += mAngularVelocity; mOrientation.x = Math::Clamp(mOrientation.x, -mPitchRange, mPitchRange); mCamera->SetRotation(mOrientation + mAngularOffset); 1 Quote Link to comment Share on other sites More sharing options...
YouGroove Posted February 22, 2014 Author Share Posted February 22, 2014 Thanks. But does not LE3 would have some smoothing method included in the engine or functions instead as everybody will have to smooth when using char controller ? why re inventing the wheel each time ? Or propose a smooth demo that can be ported to FPS, TPS or any other character game type ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Tim Shea Posted February 22, 2014 Share Posted February 22, 2014 Probably. I think the Math::Curve function does the same kind of thing. I just never noticed that function, so I rolled my own. 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.