Jump to content

Ace1024

Members
  • Posts

    8
  • Joined

  • Last visited

Ace1024's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks Metatron, I wasn't sure if this feature was supported out-of-the-box by LE. So is the terrain a child of a scene, or is it something else? If it's a child, then is it part of the terrain class?
  2. Is there a way to change the detail of the terrain from an .sbx scene in Blitzmax? Thanx, Ace1024
  3. Sorry, I am attaching the .bmx code that I was using. I apologize for the redundancy for a lot of the code, i just like to see it all when i try something new. Framework leadwerks.engine RegisterAbstractPath AppDir Graphics(800,600) If Not CreateWorld() Notify "Failed to create world.",1 End EndIf pivot:tentity=createpivot() positionentity pivot,vec3(0) Local cam:TCamera=CreateCamera(pivot) MoveEntity cam,vec3(0,0,-7) Local gbuffer:TBuffer gbuffer=CreateBuffer(800,600,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL) Collisions 1,1,True Global player:Tmesh=Loadmesh("Models\Player\Player 13.gmf") positionentity player,Vec3(0,-3,0) scaleentity player,Vec3(1) 'animate(player,1) createragdoll(player) entityparent player,pbody Local ground:TBody=CreateBodyBox(20,0.1,20) PositionEntity ground,vec3(0,-6,0) EntityType ground,1 Local ground2:TBody=CreateBodyBox(40,0.1,40) PositionEntity ground2,vec3(0,-8,0) EntityType ground2,1 Local groundtwo=CreateBodybox(10) ScaleEntity groundtwo,vec3(1,0.1,1) rotateentity groundtwo,vec3(5,0,0) PositionEntity groundtwo,vec3(0,-6,0) EntityType groundtwo,1 Local groundthree=CreateBodybox(10) ScaleEntity groundthree,vec3(0.1,40,40) PositionEntity groundthree,vec3(-20,0,0) EntityType groundthree,1 Local groundmesh:TMesh=CreateCube() ScaleEntity groundmesh,vec3(20,0.1,20) positionentity groundmesh,vec3(0,-5,0) EntityParent groundmesh,ground,0 material=CreateMaterial() SetMaterialColor material,vec4(0,1,1,1) PaintEntity groundmesh,material Local mark:tmesh=createsphere() scaleentity mark,vec3(.25,.25,.25) positionentity mark,vec3(0,1.25,-1) Local light:TLight=CreateDirectionalLight() RotateEntity light,vec3(35,55) While Not KeyHit(KEY_ESCAPE) Or AppTerminate() If KeyDown(KEY_RIGHT) turnentity pivot,vec3(0,5,0) EndIf If KeyDown(KEY_LEFT) turnentity pivot,vec3(0,-5,0) EndIf If KeyDown(KEY_UP) moveentity cam,vec3(0,0,1) EndIf If KeyDown(KEY_DOWN) moveentity cam,vec3(0,0,-1) EndIf If KeyDown(KEY_W) moveentity cam,vec3(0,1,0) EndIf If KeyDown(KEY_S) moveentity cam,vec3(0,-1,0) EndIf If KeyHit(KEY_SPACE) AddBodyForce(torsop,Vec3(0,1000,1000),0)' apply force End If If KeyHit(KEY_1) debugphysics(0) EndIf If KeyHit(KEY_2) debugphysics(1) EndIf UpdateWorld() SetBuffer gbuffer RenderWorld() SetBuffer BackBuffer() RenderLights(gbuffer) Flip() Wend End Function CreateRagDoll(ragdollmesh:tentity) Global ppos:TVec3 ppos=EntityPosition(ragdollmesh) head:Tentity=FindChild(ragdollmesh,"Head") headpos:tvec3=entityposition(head) Global torso:Tentity=FindChild(ragdollmesh,"Armature.001") Global torsopos:tvec3=entityposition(torso) rightshoulder:tentity=FindChild(ragdollmesh,"Shoulder.R") rightshoulderpos:tvec3=entityposition(rightshoulder) leftshoulder:tentity=FindChild(ragdollmesh,"Shoulder.L") leftshoulderpos:tvec3=entityposition(leftshoulder) rightbicep:tentity=FindChild(ragdollmesh,"Bicep.R") rightbiceppos:tvec3=entityposition(rightbicep) leftbicep:tentity=FindChild(ragdollmesh,"Bicep.L") leftbiceppos:tvec3=entityposition(leftbicep) rightforearm:tentity=FindChild(ragdollmesh,"Forearm.R") rightforearmpos:tvec3=entityposition(rightforearm) leftforearm:tentity=FindChild(ragdollmesh,"Forearm.L") leftforearmpos:tvec3=entityposition(leftforearm) righthip:tentity=FindChild(ragdollmesh,"Hip.R") righthippos:tvec3=entityposition(righthip) lefthip:tentity=FindChild(ragdollmesh,"Hip.L") lefthippos:tvec3=entityposition(lefthip) rightleg:tentity=FindChild(ragdollmesh,"Thigh.R") rightlegpos:tvec3=entityposition(rightleg) leftleg:tentity=FindChild(ragdollmesh,"Thigh.L") leftlegpos:tvec3=entityposition(leftleg) rightcalf:tentity=FindChild(ragdollmesh,"Calf.R") rightcalfpos:tvec3=entityposition(rightcalf) leftcalf:tentity=FindChild(ragdollmesh,"Calf.L") leftcalfpos:tvec3=entityposition(leftcalf) headp:tbody=createbodysphere(.35) positionentity headp,vec3(ppos.x+0,ppos.y+3+2,ppos.z+0) setbodymass headp,1.0 entitytype headp,1 entityparent head,headp setbodymass headp,1 SetBodyElasticity headp,0 Global torsop:tbody=createbodybox(1,1.5,.5) positionentity torsop,vec3(0,ppos.y+3+.75,0) setbodymass torsop,1.0 entitytype torsop,1 entityparent torso,torsop setbodymass torsop,1 SetBodyElasticity torsop,0 rightshoulderp:tbody=createbodysphere(.125) positionentity rightshoulderp,vec3(ppos.x+.675,ppos.y+3+1.25,ppos.z+0) setbodymass rightshoulderp,1.0 entitytype rightshoulderp,1 entityparent rightshoulder,rightshoulderp setbodymass rightshoulderp,1 SetBodyElasticity rightshoulderp,0 leftshoulderp:tbody=createbodysphere(.125) positionentity leftshoulderp,vec3(ppos.x+-.675,ppos.y+3+1.25,ppos.z+0) setbodymass leftshoulderp,1.0 entitytype leftshoulderp,1 entityparent leftshoulder,leftshoulderp setbodymass leftshoulderp,1 SetBodyElasticity leftshoulderp,0 rightbicepp:tbody=createbodybox(.25,.5,.25) rotateentity rightbicepp,vec3(0,0,10) positionentity rightbicepp,vec3(ppos.x+.675,ppos.y+3+.75,ppos.z+0) setbodymass rightbicepp,1.0 entitytype rightbicepp,1 entityparent rightbicep,rightbicepp SetBodyElasticity rightbicepp,.1 setbodymass rightbicepp,1 SetBodyElasticity rightbicepp,0 leftbicepp:tbody=createbodybox(.25,.5,.25) rotateentity leftbicepp,vec3(0,0,-10) positionentity leftbicepp,vec3(ppos.x+-.675,ppos.y+3+.75,ppos.z+0) setbodymass leftbicepp,1.0 entitytype leftbicepp,1 entityparent leftbicep,leftbicepp SetBodyElasticity leftbicepp,.1 setbodymass leftbicepp,1 SetBodyElasticity leftbicepp,0 rightforearmp:tbody=createbodybox(.25,.5,.25) rotateentity rightforearmp,vec3(0,0,10) positionentity rightforearmp,vec3(ppos.x+.75,ppos.y+3+-.25,ppos.z+0) setbodymass rightforearmp,1.0 entitytype rightforearmp,1 entityparent rightforearm,rightforearmp SetBodyElasticity rightforearmp,.1 setbodymass rightforearmp,1 SetBodyElasticity rightforearmp,0 leftforearmp:tbody=createbodybox(.25,.5,.25) rotateentity leftforearmp,vec3(0,0,-10) positionentity leftforearmp,vec3(ppos.x+-.75,ppos.y+3+-.25,ppos.z+0) setbodymass leftforearmp,1.0 entitytype leftforearmp,1 entityparent leftforearm,leftforearmp SetBodyElasticity leftforearmp,.1 setbodymass leftforearmp,1 SetBodyElasticity leftforearmp,0 righthipp:tbody=createbodysphere(.25) positionentity righthipp,vec3(ppos.x+.25,ppos.y+3+-.25,ppos.z+0) setbodymass righthipp,1.0 entitytype righthipp,1 entityparent righthip,righthipp setbodymass righthipp,1 SetBodyElasticity righthipp,0 lefthipp:tbody=createbodysphere(.25) positionentity lefthipp,vec3(ppos.x+-.25,ppos.y+3+-.25,ppos.z+0) setbodymass lefthipp,1.0 entitytype lefthipp,1 entityparent lefthip,lefthipp setbodymass lefthipp,1 SetBodyElasticity lefthipp,0 rightlegp:tbody=createbodybox(.5,1,.5) positionentity rightlegp,vec3(ppos.x+.25,ppos.y+3+-1,ppos.z+0) setbodymass rightlegp,1.0 entitytype rightlegp,1 entityparent rightleg,rightlegp setbodymass rightlegp,1 SetBodyElasticity rightlegp,0 leftlegp:tbody=createbodybox(.5,1,.5) positionentity leftlegp,vec3(ppos.x+-.25,ppos.y+3+-1,ppos.z+0) setbodymass leftlegp,1.0 entitytype leftlegp,1 entityparent leftleg,leftlegp setbodymass leftlegp,1 SetBodyElasticity leftlegp,0 rightcalfp:tbody=createbodybox(.5,1,.5) positionentity rightcalfp,vec3(ppos.x+.25,ppos.y+3+-2.5,ppos.z+0) setbodymass rightcalfp,1.0 entitytype rightcalfp,1 entityparent rightcalf,rightcalfp setbodymass rightcalfp,1 SetBodyElasticity rightcalfp,0 leftcalfp:tbody=createbodybox(.5,1,.5) positionentity leftcalfp,vec3(ppos.x+-.25,ppos.y+3+-2.5,ppos.z+0) setbodymass leftcalfp,1.0 entitytype leftcalfp,1 entityparent leftcalf,leftcalfp setbodymass leftcalfp,1 SetBodyElasticity leftcalfp,0 headtorsojoint:tjoint=createjointball(headp,torsop,vec3(ppos.x+0,ppos.y+3+1.25,ppos.z+-.01)) rightshouldertorsojoint:tjoint=createjointball(rightshoulderp,torsop,vec3(ppos.x+.675,ppos.y+3+1.25,ppos.z+0)) leftshouldertorsojoint:tjoint=createjointball(leftshoulderp,torsop,vec3(ppos.x+-.675,ppos.y+3+1.25,ppos.z+0)) rightbicepshoulderjoint:tjoint=createjointfixed(rightshoulderp,rightbicepp,vec3(ppos.x+.675,ppos.y+3+1.25,ppos.z+0)) leftbicepshoulderjoint:tjoint=createjointfixed(leftshoulderp,leftbicepp,vec3(ppos.x+-.675,ppos.y+3+1.25,ppos.z+0)) rightforearmbicepjoint:tjoint=createjointball(rightbicepp,rightforearmp,vec3(ppos.x+.675,ppos.y+3+.25,ppos.z+0)) leftforearmbicepjoint:tjoint=createjointball(leftbicepp,leftforearmp,vec3(ppos.x+-.675,ppos.y+3+.25,ppos.z+0)) righthiptorsojoint:tjoint=createjointfixed(righthipp,torsop,vec3(ppos.x+0,ppos.y+3+1.25,ppos.z+0)) lefthiptorsojoint:tjoint=createjointfixed(lefthipp,torsop,vec3(ppos.x+0,ppos.y+3+1.25,ppos.z+0)) rightleghipjoint:tjoint=createjointball(righthipp,rightlegp,vec3(ppos.x+.25,ppos.y+3+-.30,ppos.z+0)) leftleghipjoint:tjoint=createjointball(lefthipp,leftlegp,vec3(ppos.x+.25,ppos.y+3+-.30,ppos.z+0)) rightcalflegjoint:tjoint=createjointball(rightlegp,rightcalfp,vec3(ppos.x+.25,ppos.y+3+-1.75,ppos.z+0)) leftcalflegjoint:tjoint=createjointball(leftlegp,leftcalfp,vec3(ppos.x+.25,ppos.y+3+-1.75,ppos.z+0)) EndFunction Basically, all that I'm doing is placing a joint in between two bodies. However, as all of the bodies of the ragdoll get connected, the ragdoll basically functions as one big body and the joints just seem to "glue" the bodies together.
  4. Hi, I'm new to the community but i have been using leadwerks for a while. Anyway, how would you create ragdolls using Newton physics? The problem that I've been having is that when I attach bodies together with joints, the bodies still seem to move together unless a force (that isn't gravity) is applied to one of the bodies. Then, the body that the force is applied to rotates independently from the other body while still being connected.
×
×
  • Create New...