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.

DarkBASIC Professional Discussion / "Weld tool" (Gmod) using ODE physics for DBP5.9 to 6.6

Author
Message
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 19th Oct 2007 10:10
For those of you who know Gmod you will know there is a tool called the "weld tool" that can join objects together.

For those of you who don't know Gmod I will tell you there is a tool called the "weld tool" that can rigidly join 2 dynamic objects together.

I ask, how is this done in a literal sense?

I mean, I have the physics engine, its ODE physics, and I can obviously do all the DBP commands. Does anyone have any idea on the method behind holding 1 object in place, rigidly, in relation to another object, so one can be moved and the other will move with it?

Thanx

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Oct 2007 10:30
Buy DarkPhysics - ODE is really not the best solution, not for complex stuff like this.

We're going down... in a spiral to the ground...
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 19th Oct 2007 10:32
In most physics engines I'd imagine it'd be called a Static Joint or it can generally be any joint with no angular movement allowed. AFAIK the DBP implementation of ODE is very limited so I'm not sure if such a joint exists, however with Newton/PhysX you can.

TinTin
17
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 19th Oct 2007 12:40
surely you'll not need physics to achieve this.
I may be picking this up wrong but...
I'd write a few routines that return values depending on the set inputs, each object would be stored in a type statement that has provision for...(see sample)


This way you can move a Parent object, and all the Child objects will automaticaly follow, the variance value would allow for spring/elasticity functionality.

Eg. Identical Objects 1 to 10, each being tied to the previous Object, So Object 10's parent is Object 9, 9's is 8, 8's is 7 and so on. with there angle variances set to 5 then turning object 1 by 50 all the child object would form a curve that would straighten out over a set time.

Go Create...

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Oct 2007 12:54
If it was just a case of sticking 2 objects together, then he could glue an object to another's limb, or even create a mesh from the second object and add it as a new limb to an object. You can stick objects together in a few ways without resorting to manual methods.

But he's looking to apply physics to them as well, in DarkPhysics it's easy to do this and still retain collision functionality - I mean you can stick a sphere onto a cloth object and have the cloth drag around, even have the sphere swing back and forth. For all we know he might want the objects to be able to break apart in some cases.

We're going down... in a spiral to the ground...
GICO
19
Years of Service
User Offline
Joined: 22nd Jun 2004
Location: Probably watching The Monkey Show
Posted: 19th Oct 2007 13:00
The only problem is that Dark Physics Fixed Joint is far from fixed. The two rigid bodies can still jiggle to an extent.
That's my experience anyway.

Give food, give give!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2007 13:56 Edited at: 19th Oct 2007 13:57
GICO: Have you tried increasing the break limits on the joint to something ridiculously high? Things don't seem to just "snap", they start to bend and pull before they break, which can give undesirable results.

GICO
19
Years of Service
User Offline
Joined: 22nd Jun 2004
Location: Probably watching The Monkey Show
Posted: 19th Oct 2007 14:11
I don't think it has anything to do with break limits. If you create an unbreakable fixed joint, it's still not entirely fixed. Welding in GMod doesn't make it completely fixed either mind, but it is still a much better joint.
I haven't been playing around with the PhysX SDK enough to tell if it's PhysX's or Dark Physics "fault" though.

Give food, give give!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2007 16:15
You're right, I just tried with the chair demo and huuuge break limits. Makes no difference.

One for Mike I think. Sorry, let's get back on topic!

The ODE wrapper doesn't have joints. ODE may, but not the wrapper, so you would need Newton or Dark Physics.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 16:42
If the joint uses Glue Object code, under the hood - it'll jiggle. Needs to be in same vertice Hierarchy to not jiggle I'm told. Made my Cockpit jiggle in Iron Infantry DBpro version.

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Oct 2007 17:08
It depends on texturing requirements, but usually it's best to add objects together as limbs, there should be no issues with that - you can even squash the whole lot into a single mesh if you like, but that depends on if they share the same texture.

I've never messed around with physics enough to know how it would handle a complex mesh, but I think that's the best bet - load in your object, make it into a mesh, then add it as a limb to the parent object. Glue object has a number of issues, but the main niggle for me was how you loose the bone position tracking on glued objects - when your using bone positions to say, track the start and end of a weapon barrel, you can't glue it - I end up having to animate the gun and character as 1 model.

We're going down... in a spiral to the ground...
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 17:10
Ouch - You just said (to my mind) You need to buy Calligari so you can modify the DarkMatter Models - OUCH $$$

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 19th Oct 2007 18:25
no, any modeller that can import 3DS or X can be used. Wings 3D is free, and can be used.

C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 19th Oct 2007 19:31
Jeez, nuff posts.

Anyway:

I can't get Dark Physics because I don't actually know what it is, because whenever I ask, no one will tell me. And also the chances are it will cost.

I can't use types because, well, what can types do that arrays and other value-addressing formats can't? (So I never learnt.)

I can't use limbs because, well, I just can't. I don't have a singular clue as to how to attatch 2 objects together other than to position 1 in relation to another.

Feel free to help on any of the 3 above topics.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 20:05
a:
Quote: "I can't get Dark Physics because I don't actually know what it is, because whenever I ask, no one will tell me. And also the chances are it will cost."


DarkPhysics is an $$ adon like you mentioned, but there is also ODE (heard mixed reviews) and Newton - both of which have a means to "work with em" from within DBPro. They are kinda weird - and I'm a old hand at coding - weird in that it makes sense but it strange kinda. You have to set up two "Mirrorish" Worlds - in that you make your 3d gfx stuff - but in ther alternate reality - You make Boxes" or whatever objects that represent those 3d Graphics - but you assign how heavy they are, their mass, and then they get glued together kinda. So Your "Create" with wood texture, could get kicked in the Physics Environment, and then low and behold - your graphical one gets all its coordinates from the Physics engine - so now your Nice prett 3d crate is tumbling pretty realistically. You've seen this in games already I'm sure. Personally I want to use one myself - but I'm using DarkGDK, and DarkPhysics doesn't work with that yet - and Newton Demos had a bit of flaws I don't want to bother with - like overcontrol - if to much force... say you Toss the rag doll in the demo to hard - it shakes jiggles and loses control and looks assanine. ODE I heard is limited at the gate. Dark Physics I hear is pretty decent - limited for Vehicles - but I guess if its stable you could make complex vehilces probably by attaching two or more somehow.


b:
Quote: "I can't use types because, well, what can types do that arrays and other value-addressing formats can't? (So I never learnt.)
"


1: Organize, 2: Make Code More Readable, 3: um... 1 and 2 are pretty strong for reasons to adopt actually. They can't do MORE but seeing how this is DarkBasic we are talking about they have an EXTRA benefit. If you misspell a variable in DarkBasic, it creates a new variable and unless you locate that mispelled variable you will pull your hair out trying to debug your code. If you stuff all your variables in a type - not best practice - but if you did - I do this with my global "just needed this new variable because..." ...anyways - the compiler will not compile MyType.Mispelled because it doens't know what it is. This is kind of a cheap way to get DarkBasic to do something known as Explicit Variable Declaration. If you don't specify a variable in the declaration - then it can't be used. Big Time Saver over the length of any project.

How?





c:
Quote: "I can't use limbs because, well, I just can't. I don't have a singular clue as to how to attatch 2 objects together other than to position 1 in relation to another."


Well - you get jiggles like this - sometimes its ok - sometimes not. Glue Object to Limb seems to work exactly the same way as just positioning them relative to each other - someone told me if floats were perfect the jiggle wouldn't happen - but rounding causes just enough a difference to cause it.

For Texturing - this 2 objects to become one object two limbs thing gets dicey. However - when you have one texture you can texture the whole object with - not so bad

Basically I think it goes something like:


Good Luck!

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th Oct 2007 20:10
So what your saying is ''Teach you how to do this stuff but make sure you don't learn anything''

10 minutes experimentation with the limb and mesh commands is all it would take to learn them.

DarkPhysics is a plugin that gives Ageia physics, which are used in professional engines like Unreal3 - it works like a much more advanced ODE, you can setup complex object structures and stuff like that. I don't think it's too expensive considering what you get.

We're going down... in a spiral to the ground...
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 20:29
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 19th Oct 2007 21:09 Edited at: 19th Oct 2007 21:09
@ jason p sage - I see... well some of that made sense, but types still don't seem logical to me as of yet.

@ Van B - I was saying, exactly what I said. - I didn't say anywhere "Teach me how to do this stuff but make sure I don't learn anything."

and 10 minutes experimentation with the limb and mesh commands isn't all it takes to learn them otherwise, I wouldn't have asked. I have done that 10 minutes experimentation, I just simply don't get what they are, or how to apply them in a program.

@ The rest of what Van B said - How much exactly would you say Dark Physics is? And when I have it, it is basically just another plug-in for DBP?

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 22:22
Good Question. I just hunted for it (a little - via the drop down menus after clicking the "SHOP" icon on the top of this page... and well.. I didn't find it yet... but I'm not the one looking to buy it right anyway - waiting for GDK version myself

calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 19th Oct 2007 23:25
Yes, Dark Physics is just another plugin for DBPro, but can attain higher states of speed than the equivalent using collision cupled with basic physical principles (like gravity, air resistance, laminas etc.)

I can't be bothered to invent a signature
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Oct 2007 23:44 Edited at: 19th Oct 2007 23:50
laminas ? Oh Google here we go again!

[edit]Wow - is that how something behaves when it gets whacked? All I found so far are thick physics formulas. I also saw stuff that suggests it might have to do with how electricity bounces around - saw the shape of a lightning bolt... I don't know what it is but if its in DarkPhysics...col [/edit]

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 20th Oct 2007 00:19 Edited at: 20th Oct 2007 00:20
Here's a link to it, costs £29.99

Quote: "http://darkphysics.thegamecreators.com/"


See how in that bridge screenie the ball is rolling along, well the bridge bends and shakes just like a real bridge, it's made from lots of plank objects linked together, it's possible to actually break the bridge it you were to hit it hard enough. DarkPhysics is great for that sort of stuff, but as already discussed it's not ideal at actually sticking objects together, for that it's best to make the objects from bits then apply physics properties to the completed object.

The mesh and limb commands would allow you to create models based on meshes that you load in. I've never used Gmod, but I'm guessing you can make objects from the different physics objects in the game. If you had some models that you want to be able to add together to make new objects, you would load them as meshes (LOAD MESH), then starting with a base mesh you can create the root object from these (CREATE OBJECT Obj,Mesh,Image). Say you had a milk crate mesh and a milk bottle mesh, you could create an object from the milk crate mesh, then add each milk bottle as a separate limb. Once you figure out how many limbs the object already has (in this case just 1), you can add in a limb from the mesh number (ADD LIMB Object Number, Limb Number, Mesh Number). Increase the limb number each time, but once you've added the limb, you can then offset and rotate it however you like (OFFSET LIMB Obj,Limb,X,Y,Z and ROTATE LIMB Obj,Limb,X,Y,Z). By loading your textures in manually, you will be able to manually texture each limb, because adding a limb will not automatically give it a texture you have to texture the limb yourself (TEXTURE LIMB Obj,Limb,Image). It takes a bit of organising, but it's really the only way to do it. If all the limbs your adding use the same texture then you could create a new mesh from that object and texture it with the appropriate texture, this would 'flatten' the object into a single mesh.

We're going down... in a spiral to the ground...
EdzUp
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 20th Oct 2007 00:23
Couldnt you take the vertices and triangles (with all UV's) from one model and patch them into the other model, this would technically weld them together permanently (they would become one model)

-EdzUp
C0wbox
17
Years of Service
User Offline
Joined: 6th Jun 2006
Location: 0,50,-150
Posted: 20th Oct 2007 12:30
Wow, sounds like I've got some work to do, and a lot of learning.

Next learning curve - how exactly would I take the desired verticies and triangles and stick 'em to something else? (I never did understand UV, because when trying any UV commands to make say, the texture scroll, it simply didn't work.)

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Oct 2007 14:32
I'm no expert on UV - but in TED and the way the Exports work - UV's seem to be both the Position of a texture on the model, and the "uv offsets" which can make the textures scroll. In Iron Infantry I got it to work after some (alot) of trial and error. In order to figure it out I needed to make keys that would adjust the increment up and down - both alot and a little - like:

MyIncrement#=0

if keystate(cnScanCode_1) then inc MyIncrement#, 0.01
if keystate(cnScanCode_2) then dec MyIncrement#, 0.01
if keystate(cnScanCode_3) then inc MyIncrement#, 1.0
if keystate(cnScanCode_4) then dec MyIncrement#, 1.0

then I had two more keys to actually take that "MyIncrement Value and use it with the offset texture commands - I got it to work to make the treads turn on the tank. Then to make it "Consistant" I made that timer based - and then I had to play even more so that it actually looked like the treads were moving in relation to the ground - so it looked "Right" and not like the treads were going faster than the tank (Constantly peeling out) or the otherway - where tank looks like it was sliding.

dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 20th Oct 2007 23:49
UVs are just two floats, the same as normals. If you're after the same weld as what Gmod has then you need to make a joint in the physics engine, attaching the objects themselves will make an unbreakable joint which isn't the same as what Gmod has, plus if an object has multiple limbs then merging objects would be much harder as converting anything to a mesh creates a single limb. This makes welding multiple objects a bit of a pain and far too slow. Plus gmod welds are far from solid.

Login to post a reply

Server time is: 2024-05-02 06:32:36
Your offset time is: 2024-05-02 06:32:36