Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Newton Lib

Author
Message
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 8th Jun 2006 19:45 Edited at: 9th Jun 2006 02:30
Well, I'm working on a Newton function library. Here is what there is so far. Functions are:

******************************************************************
*****************UPDATED FILE IN LINK*******************************
******************************************************************

StartNewton(gravity as float)
RotateBody(object,ang x,ang y, ang z)
PositionBody(object,pos x,pos y,pos z)
CreateDynamicBox(object,mass)
CreateDynamicSphere(object,mass)
CreateDynamicConHull(object,mass)
CreateStaticBox(object)
CreateTreeCol(object)
CreateBallJoint(object1,object2)
CreateHingeJoint(object1,object2)
CreateCorkScrewJoint(object1,object2)
CreateSliderJoint(object1,object2)
CreateUpVectorJoint(object)
SetWater(density,linear viscosity,angular viscosity)
SetObjectWater(object,buoyancy,water height)
UpdateNewton()
RayCast(distance,startx,starty,startz)
SetWorldSize(xsize,ysize,zsize)
MoveBody(object,value)
CreateUnsignedDynamicBox(mass,size x,size y,size z)
CreateUnsignedDynamicSphere(mass,size x,size y,size z)
AddRotationForce(objid,force x,force y,force z)
FreezeBody(objid)

These are object orientated, so you don't have to really keep track of an objects body. The functions get the body for you,so you just give the object number.

Joints work by attatching object2 to object1 at whatever angle and position object2 is at. So,if you want a ball and socket joint to be closer,simply move the dbp object closer before making the dynamic body. Or,reposition the body closer to the parent. Rotate the dbp object if you want the joint to be rotated that way.

link:
http://www.savefile.com/files/6661919

Edits:

-Demo now included in the project.
-All joints can be used now.
-Buoyancy commands now added.
-Added two simple functions.
-Added two unsigned collision hulls.
-Added move body function.
-Added a function to add a rotation force.
-Added an object oriented freeze body command.

all ben needs is his band,his guitar,and his computer
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 8th Jun 2006 23:39 Edited at: 9th Jun 2006 18:24
So far, I have tested joints and movement, water will be soon. The moving is a bit hard to get to work for you,but I'm going to try to find out how to make that easier.

Edit:

Ok, now i have a demo of it. Its basic character movement,but the turning force takes a bit to get rid of, but its a start.

Heres the link:
http://www.savefile.com/files/5223499

Heh, I think we'd better wait for darkphysics if we want some really good character controlling and what not. No offense to Walaber or Kjelle, this is a really really really good physics engine,but its complex and hard to do certain stuff(like character controlling). It was fun working with though.

all ben needs is his band,his guitar,and his computer
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 10th Jun 2006 13:16
if you get stucked somewhere, you can pick somethin from mine which can be found here:
http://forum.thegamecreators.com/?m=forum_view&t=79841&b=6
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 10th Jun 2006 18:28 Edited at: 11th Jun 2006 23:16
Cool. Really, all thats giving me troubles at the moment are a couple of joints(hinge,corkscrew,slider don't show up...) and the movement. The movement is just annoying. For some reason It doesn't let the body rotate a whole 360 degrees,only 180:-\ But, thankyou for your offer

Edit:

Wow, I like that code. I love that gui by the way. I think I will look into some of that code

all ben needs is his band,his guitar,and his computer
Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 12th Jun 2006 02:20
I'm working on a breakable joint system right now. It assigns an array to an object. When you create the joint,it creats joint(objectnum).id, so that a function called UpdateBreakJoint(object) can access it. If there is no joint,don't use this function. It will be ready soon. You will be able to give the joint a limit force by using LimitBreakJoint(object,limit x,limit y,limit z). Will post it when ready.

all ben needs is his band,his guitar,and his computer
ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 12th Jun 2006 06:23
can u add vehicles in it ? plz ?

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 13th Jun 2006 02:12
sure. Just give me some time and I will. What functionality do you want from them,cuz I've never used newton vehicles.

all ben needs is his band,his guitar,and his computer
ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 13th Jun 2006 20:27
just the basic vehicle stuff and could u make it that u can use a box as the body or a model ?

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 14th Jun 2006 07:35
I can make it like the others where you just give the id of the object. It will be a bit different than the other functions,because I'll have to assign an array to the vehicle. But that shouldn't be too hard. It'd be like Vehicle(id).whatever. And for the object it would be Vehicle(id).obj = objid. So it will be a bit different,but not too different.

all ben needs is his band,his guitar,and his computer
ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 14th Jun 2006 19:36
k sounds good

ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 23rd Jun 2006 20:22
*bump

hows it coming along ?

Xarshi
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: Ohio
Posted: 23rd Jun 2006 20:54
meh,workin' on it. Took a break for a bit,got back to work on it recently. I'll have 'em done soon maybe.

all ben needs is his band,his guitar,and his computer
ALPHA ZERO PRODUCTIONS
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: Mom ! I forgot where we live !
Posted: 24th Jun 2006 06:47
k

Login to post a reply

Server time is: 2024-11-23 03:49:39
Your offset time is: 2024-11-23 03:49:39