-
Posts
134 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Chris Paulson
-
-
You already can with the GMF library stuff.
-
Looks like the white lines are just part of the grid displayed by the editor showing through the terrain.
How did you add the grass?
Is it a model?
-
Hi,
I've updating my blog with a video of the IK and the source code.
Enjoy...
Blog: -
http://leadwerks.com/werkspace/index.php?app=blog&module=display§ion=blog&blogid=19
-
Well last night I got it working.
I need to improve the joint constraints and pick the spaghetti out of my code and I'll post it.
Watch this space.
-
True,
but for a: -
hip, knee, ankle, toe
you are solving mutiple rotations which is where it gets tricky (for me at least).
Hopefully in a couple of days I'll have it working and I'll post all the code.
-
I thought I'd chuck my views to this.
I spent several weeks investigating UDK as it's got so many more features than LE. However I came back to LE because I found myself banging my head against a brick wall in UDK and not having fun. I do the stuff in LE for fun, no other reason at the moment.
If I was going to pick features from UDK I'd like to see in LE these would be them: -
1) >5 terrain layers
2) Fracture tool (having to do doing this by hand is a lot of work)
3) Emitters (UDKs emitters are strong, LE's are weak in comparison)
4) CSG (Useful for filling over gaps in levels)
These things below I have done in LE but come as standard in UDK
5) Navmesh (without this you have no AI starting point for a modern game)
6) Locomotion
7) Complex animation blending
There's lots of other stuff in UDK that I'd like to see in LE but I don't won't to overload Josh and make him think I'm a whinging git.
-
I've now got the IK working as long as the model is not rotated. Just need to handle rotations now.
-
Thought I'd post a progress update on this as I'm still trying to get this to work...
The quaternion class did need to convert to/from radian/degrees.
The class needed a new method for converting the quaternion to eualer angles.
I wish you could get/set quaternions in LE (at present there's only a get).
Somewhere in the code there is a math error because it's not IK'ing properly.
If anyone is best mates with Pythagoras or his brother Trig feel free to pitch in...
-
Josh could probably answer this best but I'll have a go.
My experience is also that occlusion culling is off on most things other than animated models. I believe you can turn it on with a function call. I haven't got the editor to hand but isn't there a new option for this to in the properties?
I guess other things that might help are a combinations of: -
DOF
Merged into Fog
With draw distance.
-
I'm struggling to get this to work. My code is:-
void ikRanger( TVec3 position, TModel npc ) { TEntity lhip = FindChild( npc, "Frame3_figure_v05_Layer35"); TEntity lknee = FindChild( npc, "R_Knee"); TEntity lfoot = FindChild( npc, "R_Foot"); Transform thip( lhip ); Transform tknee( lknee ); Transform tfoot( lfoot ); vector<Transform> bones; bones.push_back( thip ); bones.push_back( tknee ); bones.push_back( tfoot ); IKSimple iknpc; iknpc.Solve( bones, Vector3( position.X, position.Y, position.Z )); Vector3 rot = thip.localRotation.ToAngleAxis().Axis; RotateEntity( lhip, Vec3( rot.X, rot.Y, rot.Z ) ); rot = tknee.localRotation.ToAngleAxis().Axis; RotateEntity( lknee, Vec3( rot.X, rot.Y, rot.Z ) ); rot = tfoot.localRotation.ToAngleAxis().Axis; RotateEntity( lfoot, Vec3( rot.X, rot.Y, rot.Z ) ); /* RotateEntity( lhip, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) ); rot = tknee.localRotation.ToAngleAxis().Axis; RotateEntity( lknee, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) ); rot = tfoot.localRotation.ToAngleAxis().Axis; RotateEntity( lfoot, Vec3( rad2deg(rot.X), rad2deg(rot.Y), rad2deg(rot.Z) ) ); */ }
Is "thip.localRotation.ToAngleAxis().Axis" the correct thing to get back the rotations with?
The transform class does: -
v = EntityRotation(entity,1); this->rotation = Quaternion(Vector3(v.X,v.Y,v.Z));
Isn't EntityRotation in degrees and Quaternion in rads? Should there not be a conversion?
Pity thrown at someone as bad at maths as me would be appreciated.
-
Thanks,
I'll try this out tonight against my model.
I guess the bones I pass in as transforms are: -
Hip, Knee, Foot(Ankle)
PS
I wish I was better at math , you make it look easy.
-
Yes please for the zip.
I must have be replying when you did the seconds post.
-
It isn't done, but this will IK solve hella-fast:
I recognise that code....
Looks like your getting there before me. Your using classes like Vector3 etc where do they come from?
Could I put my begging bowl out and ask for a code share...
-
The good news:-
I got a animated model moving it's limbs in sync with the physics bodies.
The bad news:-
I think this is a dead end as the physics solves the IK too slow and if you try to speed it up it oscillates. I think I need to write a proper IK solves, it will probably be easier than flogging the physics to death.
-
After a lot of fiddling I have got this working.
Here's a blitz example: -
Strict Framework leadwerks.engine Graphics 800,600 RegisterAbstractPath AppDir 'RegisterAbstractPath ".." If Not CreateWorld() RuntimeError "Failed to create world." Local cam:TCamera=CreateCamera() MoveEntity cam,Vec3(-0.2,0,-1) 'Local mesh:TMesh=CreateCube() 'Local sphere:TMesh=CreateSphere() Local hip:TBody = CreateBodyPivot( ) PositionEntity(hip,Vec3(0)) Local thigh:TBody = CreateBodyBox( 0.001, 0.2, 0.001 ) Local shin:TBody = CreateBodyBox( 0.001, 0.2, 0.001 ) Local foot:TBody = CreateBodyBox( 0.08, 0.02, 0.001 ) EntityType(thigh,1) EntityType(shin,1) EntityType(foot,1) Collisions(1,1,0) SetBodyDamping( thigh, 0, 0 ) SetBodyDamping( shin, 0, 0 ) SetBodyDamping( foot, 0, 0 ) MoveEntity(hip,Vec3(0,0.1,0)) MoveEntity(shin,Vec3(0,-0.2,0)) MoveEntity(foot,Vec3(0,-0.3,0)) SetBodyMass(thigh,10) SetBodyMass(shin,10) SetBodyMass(foot,10) SetBodyGravityMode( thigh,0) SetBodyGravityMode( shin,0) SetBodyGravityMode( foot,0) SetBodyFriction( thigh,0,0) SetBodyFriction( shin,0,0) SetBodyFriction( foot,0,0) Local knee:TBody = CreateBodyPivot( ) MoveEntity(knee,Vec3(0,-0.1,0)) EntityParent( knee, thigh ) SetBodyDamping( knee, 0, 0 ) Local kneeorb:TEntity = CreateSphere( 8, knee ) ScaleEntity( kneeorb, Vec3(0.01) ) Local ankle:TBody = CreateBodyPivot() MoveEntity(ankle,Vec3(0,-0.3,0),1) EntityParent( ankle, shin ) 'SetBodyMass(ankle,1) Local footorb:TEntity = CreateSphere( 8, ankle ) PositionEntity(footorb, Vec3(0,-0.3,0),1) ScaleEntity( footorb, Vec3(0.01) ) ''EntityParent( foot, shin ) Local ballhip:TJoint = CreateJointBall( hip, thigh, Vec3(0,0.1,0) ) SetBallJointLimits( ballhip, Vec3(0,0,0), 150, 1) 'Local ballhip:TJoint = CreateJointHinge( hip, thigh, Vec3(0,-0.1,0), Vec3(1,0,0) ) 'SetHingeJointLimits( ballhip, -90, 90 ) Local ballknee:TJoint = CreateJointHinge( thigh, shin, Vec3(0,-0.1,0), Vec3(0,0,1) ) SetHingeJointLimits( ballknee, -100, -5 ) 'Local ballknee:TJoint = CreateJointBall( thigh, shin, Vec3(0,-0.1,0) ) Local ballankle:TJoint = CreateJointHinge( shin, foot, Vec3(0,-0.3,0), Vec3(0,0,1) ) SetHingeJointLimits( ballankle, -40, 40 ) SetJointCollisionMode(ballhip,0) SetJointCollisionMode(ballknee,0) SetJointCollisionMode(ballankle,0) Local position:TVec3 Local lastposition:TVec3 = vec3(0,0,0) DebugPhysics(True) While Not KeyHit(KEY_ESCAPE) position=CameraProject(cam,vec3(MouseX(),MouseY(),1)) PositionEntity( foot, position) SetBodyVelocity(foot, vec3(0)) ' This is needed to make stuff solve IK at decent speed lastposition = EntityPosition(footorb,1) SetBodyVelocity(foot, vec3((position.x - lastposition.x) *5, (position.y - lastposition.y)*5, (position.z - lastposition.z)*5)) lastposition = position UpdateWorld( AppSpeed() ) ' UpdateWorld(100 ) RenderWorld DrawText "Move the mouse around.",0,0 Flip Wend
-
Your right about the hinges etc.
I'm struggling though, you can't get the rotation of a hinge/joint and you can't get it's position. If I do any of the mentioned calls LE GPFs. So I am having to try and work out these values which kind of defeats the object of using it as an easy replacement for an IK solver.
-
I'm sure you could use a couple of static bodies for the feet, a static body for the pelvis, and a body with mass for the knees. Connect the knees to the pelvis with a ball joint with limits, and the feet to the knees with a hinge. Move the feet wherever you want them to be, and the knees will follow. Parent the knee bones to the knee bodies, and you have IK animation.
Great idea however bit confused by combination of bodies etc. I would have thought: -
Ball joint - parented to hip pivot
Body box for thigh
Ball joint for knee
Body box for shin
Hinge for ankle
Body box for foot
To give:-
.
|
.
|
.-
but I'm probably wrong as I haven't done this before.
-
File Name: Game WIP Missing files
File Submitter: Chris Paulson
File Submitted: 08 Jan 2010
File Category: C/C++ Code
Sorry, I missed some files from my project.
-
So to move a foot up I'll have to rotate the hip and knee joint?
I presume doing rotations like this are the only option. I guessing the maths for the rotations are going to be tricky!
-
Hi,
I've started looking a footplacement of an NPC so it's feet are on the ground instead of floating.
I've tried modifying a foot bone position (using EntityPosition) believing LE had IK to sort out all the other bone positions/rotations, however what I saw was the mesh messed up.
I'm I doing something wrong?
Has LE really got IK?
-
I beleive this is because the position of the controller changed in LE versions and the zero Y pos is the centre of the controller.
If controller is 1.8 high do this:-
pos = EntityPosition( controller, 1)
PositionEntity(yourModel, vec3(pos.X, pos.Y - (1.8/2), pos.Z,1)
-
I've thought about this for my own stuff and this is what I'd do:-
Got message i've been hit by bullet
Message contains location of bullet hit
For each bone in my model
work out with math fiddle closest bone in model to hit location
next
if bone is head then
HEAD SHOT!
endif
Hopefully in a month or two I'll have a working example in C++.
However it seems to me you prehaps deciding what colour to paint your hand built car before you've even tightened the first nut or done your first weld.... I'd try to get the basics done first.
-
Very impressive Chris, very impressive indeed .. I overlooked it not being tidy, being somewhat "anti-neat" myself lol ..
It was nice to see all that code you wrote (in klingon? )
Thanks - the alien (a++) stuff came from AIGamedev.com. Well worth going and reading a few articles to give yourself ideas how the pro's go about stuff.
-
I do/did use Boost, but I prefer my own implementation, because it removes the overhead boost has from implementing for multiple platforms where I am using Windows exclusively. If you check out the boost hpp headers, you will see it uses Win32 critical sections for its mutex class on Windows.
EDIT: Actually, better than anything are the Intel Threaded Building Blocks, especially if you are on an Intel architecture CPU. Not sure if AMD has an equivalent.
I thought BOOST was multi platform and was going to be adopted as a ANSI standard?
Best performance!
in General Discussion
Posted
You'll get different answers from people about speed and whether it matters depending on how far down the road of development they are.
Beleive me once you got: -
Pathfinding
Motion graphs/blend trees
AI (FSM, HFSM, BTs)
Lots of physics
IK animation
Lots of line picks
Agent Steering
Cover maps
etc (all the things you need to make a half decent game) you'll start noticing a BIG difference and you'll be looking to squeeze every ms you can.
There is more to a game other than shaders, pretty lights, fluffy cloads and waves...