Page 1 of 1
Posted: 10 Mar 2009, 07:00
SkindupTruk


hello all,

i want to put up some vbscripts that can allow you to edit the hull files for cars. i think this will allow you to modify how the car collides with the world, but i'm only guessing... ali suggested that the spheres are used for collisions, but i wonder what the edge data is used for?

anyway, what i want to know is if you would prefer:

HULL to TXT

a. a box pop up to ask where the hull file is each time
b. you put the hull file in the same dir, run the script, and it pumps out a txt file for direct editing

***you edit the text file as you please, then...***

TXT to HULL

a. a box pop up to ask where the text file is each time
b. you put the text file in the same dir, run the script, and it pumps out a hull file for use in RV

???

PS. I'd prefer b for both but that's just me!

PPS. here is the txt for the toyeca.hul to give you an idea of what i mean

Code: Select all

total	1
vertexs	12
edges	24
faces	14
bbox	-30.768
bbox	30.768
bbox	-12.104
bbox	12.104
bbox	-61.966
bbox	61.966
unkcom	0.008
unkcom	-24.229
unkcom	1.929
vertex-1-1	22.176
vertex-1-2	-36.323
vertex-1-3	-18.194
vertex-2-1	28.226
vertex-2-2	-12.214
vertex-2-3	-60.037
vertex-3-1	18.943
vertex-3-2	-28.994
vertex-3-3	-58.249
vertex-4-1	26.713
vertex-4-2	-22.706
vertex-4-3	46.303
vertex-5-1	30.776
vertex-5-2	-12.126
vertex-5-3	63.895
vertex-6-1	21.015
vertex-6-2	-35.95
vertex-6-3	4.508
vertex-7-1	-22.168
vertex-7-2	-36.333
vertex-7-3	-18.201
vertex-8-1	-28.231
vertex-8-2	-12.211
vertex-8-3	-60.03
vertex-9-1	-26.693
vertex-9-2	-22.709
vertex-9-3	46.305
vertex-10-1	-21.06
vertex-10-2	-35.953
vertex-10-3	4.509
vertex-11-1	-30.759
vertex-11-2	-12.126
vertex-11-3	63.894
vertex-12-1	-18.959
vertex-12-2	-28.979
vertex-12-3	-58.246
edge	0
edge	1
edge	1
edge	2
edge	0
edge	2
edge	0
edge	3
edge	1
edge	3
edge	3
edge	4
edge	1
edge	4
edge	3
edge	5
edge	0
edge	5
edge	6
edge	7
edge	7
edge	8
edge	6
edge	8
edge	6
edge	9
edge	8
edge	9
edge	7
edge	10
edge	8
edge	10
edge	6
edge	11
edge	7
edge	11
edge	2
edge	11
edge	1
edge	7
edge	0
edge	6
edge	5
edge	9
edge	3
edge	8
edge	4
edge	10
normal-1	0.857
normal-2	-0.491
normal-3	-0.159
distance	-39.718
normal-1	0.965
normal-2	-0.263
normal-3	-0.012
distance	-31.18
normal-1	0.944
normal-2	-0.33
normal-3	-0.019
distance	-31.822
normal-1	0.847
normal-2	-0.529
normal-3	0.052
distance	-37.045
normal-1	-0.965
normal-2	-0.263
normal-3	-0.012
distance	-31.171
normal-1	-0.852
normal-2	-0.521
normal-3	0.05
distance	-36.903
normal-1	-0.943
normal-2	-0.331
normal-3	-0.019
distance	-31.818
normal-1	-0.857
normal-2	-0.491
normal-3	-0.159
distance	-39.709
normal-1	0
normal-2	-0.106
normal-3	-0.994
distance	-60.989
normal-1	0
normal-2	-0.984
normal-3	-0.181
distance	-39.017
normal-1	0
normal-2	-1
normal-3	0.017
distance	-36.022
normal-1	0
normal-2	-0.953
normal-3	0.302
distance	-35.634
normal-1	0
normal-2	1
normal-3	-0.001
distance	12.171
normal-1	0
normal-2	-0.857
normal-3	0.516
distance	-43.332
spheres	18
sphere	19.129
sphere	-21.382
sphere	-50.282
sphere	10.165
sphere	19.429
sphere	-21.946
sphere	24.33
sphere	12.183
sphere	19.422
sphere	-19.608
sphere	41.077
sphere	9.36
sphere	0.079
sphere	-17.159
sphere	56.769
sphere	7.865
sphere	14.069
sphere	-22.43
sphere	1.909
sphere	13.885
sphere	-19.577
sphere	-21.382
sphere	-50.282
sphere	10.165
sphere	-18.573
sphere	-21.781
sphere	-38.479
sphere	12.16
sphere	-14.326
sphere	-22.51
sphere	-21.287
sphere	14.089
sphere	-18.746
sphere	-19.608
sphere	41.077
sphere	9.36
sphere	-14.064
sphere	-22.43
sphere	1.909
sphere	13.885
sphere	14.064
sphere	-22.51
sphere	-21.287
sphere	14.089
sphere	0.042
sphere	-21.382
sphere	-50.282
sphere	10.165
sphere	0.042
sphere	-19.883
sphere	41.389
sphere	10.165
sphere	-19.278
sphere	-21.946
sphere	24.33
sphere	12.183
sphere	0.096
sphere	-21.946
sphere	19.888
sphere	12.183
sphere	-14.833
sphere	-17.159
sphere	53.253
sphere	7.865
sphere	15.041
sphere	-17.159
sphere	53.253
sphere	7.865
sphere	18.43
sphere	-21.781
sphere	-38.479
sphere	12.16

Posted: 11 Mar 2009, 03:52
Adamodell
That is... nutty... to say the least.
Very nutty.

Do whatever YOU prefer... but couldn't you use this knowledge to make a prm2hul? You know, use the information on all the polygon's dimensions in the prm and then convert them to a compatible hul, if that is even possible. srmalloy wanted to make a prm2hul but he just disappeared.

Posted: 11 Mar 2009, 07:02
zagames
To start, this is a great idea. I would also prefer option B in both cases, just to simplify things. Or perhaps make it work with a command prompt/batch file. Like Adam said, I think a prm2hul would be an excellent program, but hul2txt is a great start. Two thumbs up,
Zach

Posted: 11 Mar 2009, 14:07
urnemanden
Maybe ncp2hul is easier and could maybe be more usefull. I don't know if the hul file contain the same information as the ncp file (surface properties etc.), but if it did, then it would be much better to make a ncp2hul. ;)

EDIT: Oh, and "Edge" might be the resistance the hull file has. But I dont know.

Posted: 11 Mar 2009, 17:57
SkindupTruk
ok i'll work on option b over the next few days and we'll see how it goes

i'll leave it up to you guys to tell me what changing the edges does vs. changing the size of the spheres

Posted: 11 Mar 2009, 19:21
Piereligio
SkindupTruk @ Mar 10 2009, 02:30 AM wrote: TXT to HULL

a. a box pop up to ask where the text file is each time
b. you put the text file in the same dir, run the script, and it pumps out a hull file for use in RV
I can't understand it, but I need of it. Can you tell it me better? (I'm Italian...)

Posted: 12 Mar 2009, 01:02
zipperrulez
anything to do with hul editing, i want to know about.

Posted: 15 Mar 2009, 11:15
zagames
How's the project coming?

Posted: 15 Mar 2009, 17:09
Adamodell
Piereligio @ Mar 11 2009, 02:51 PM wrote:
SkindupTruk @ Mar 10 2009, 02:30 AM wrote: TXT to HULL

a.  a box pop up to ask where the text file is each time
b.  you put the text file in the same dir, run the script, and it pumps out a hull file for use in RV
I can't understand it, but I need of it. Can you tell it me better? (I'm Italian...)
Uh, he's basically talking about a script he's going to work on.

You make a text file that has all that data (like the toyeca.txt one) and you compile it into a hul. You could edit the txt by hand and make your own huls.

Posted: 22 Mar 2009, 20:33
SkindupTruk
hul2txt.vbs

txt2hul.vbs

instructions:
  • PLEASE BACKUP YOUR ENTIRE REVOLT DIR!!!
  • save these 2 files to a new dir
  • copy a hull.hul file to the same dir (must be called hull.hul)
  • run hul2txt.vbs and check that hull.hul.txt was created
  • edit hull.hul.txt and save (must be called hull.hul.txt)
  • run txt2hul.vbs and check that hull.hul.out was created
  • put this new .out file back into the car directory you got hull.hul from
  • backup hull.hul to a new name or place, then delete it
  • rename hull.hul.out to just hull.hul
  • start revolt and check the effect of your edits!
for example, i did this to toyeca. i changed the radius of the first sphere:

OLD hull.hul.txt

Code: Select all

spheres	18
sphere	19.129
sphere	-21.382
sphere	-50.282
sphere	10.165
NEW hull.hul.txt

Code: Select all

spheres	18
sphere	19.129
sphere	-21.382
sphere	-50.282
sphere	50.165
when i loaded the new hull file, my toyeca had it's back wheels off the ground all the time. ie. the sphere is causing a collision with the track all the time.

so please try things out, and let me know how it goes as i don't have much time to figure out what each thing does. i guess that spheres are for full sim mode, and edges are for simple mode?

someone wanted a visual tutorial, i will try to animate the above list to show the exact steps soon.

urne, you are right that NCP are similar to HUL files in a way, as they both use some clipped plane data. but NCP does not have sphere or edge data like a HUL file has...

Posted: 22 Mar 2009, 22:00
urnemanden
I tried to open hul2txt.vbs, but I got an error:



Same happens with the other vbs file. :(

Posted: 22 Mar 2009, 23:54
zagames
Both programs work fine for me. No errors. Excellent! Now all we have to do is find out what everything means. :P

Posted: 23 Mar 2009, 01:21
zagames
Well, I've been playing with this for an hour or so now, and I know for sure that the spheres are only for world collision. The box I can't tell, but the edges I think are for collision with other objects. I've been playing with the ABC block. I think the boxes are for simple collisions. I would really like to know exactly how the normals work, I seem to have created some sort of glitches playing with it. hehe. Let me know if I'm wrong people, submit some test results. ;)

Posted: 24 Mar 2009, 04:13
zagames
And now, after many more hours of 'playing' I have some information. My test object was the ABC Block. I discovered that all you really need for collision is the bbox, normals, and spheres.

BBox = not really sure why it's there. But you have to have some value set if you want the object to collide, even 0,0,0 0,0,0 works.

Normals = Collision with the car. Have to set up the six sides whatever distance from the center out.

Spheres = Collision with the world and other objects. x,y,x coordinates and the radius.

The spheres must keep the normals from touching the ground. If the normals extend further out than the spheres, there is a weird collision bug causing the objects/cars to bounce around when touching.

As far as saving space, the total vertex and edge numbers can be set to 0, and the vertex1-1.... and edge # can be removed. Like I said bbox can be set to all 0's. That's it for now. Later.

Posted: 24 Mar 2009, 17:14
KDL
wow this is a very nice tool
thanks a lot :D

Posted: 25 Mar 2009, 19:12
KDL
Small Code fix [it's totally optional]... it's about hull.hul and the output text path etc...
* hul2txt.vbs

Code: Select all

Set fso = CreateObject("Scripting.FileSystemObject")
	path = fso.getparentfoldername(fso.getabsolutepathname("blah"))

	s = inputbox("Hul file?","Hull file please?","Hull.hul")
	if s ="" then 
	msgbox "But..."& vbnewline &"it's empty"
	exit sub
	end if

	ss =inputbox("Where to save the file?","TXT",s & ".txt")
	if instr(1,ss,".txt",vbtextcompare) = 0 then ss = ss &".txt"
  
	if ss =".txt" then 
	msgbox "But..."& vbnewline &"it's empty"
	exit sub
end if
* txt2hul.vbs

Code: Select all

Set fso = CreateObject("Scripting.FileSystemObject")
	path = fso.getparentfoldername(fso.getabsolutepathname("blah"))

	
	s = inputbox("txt file?","text file please?","Hull.hul.txt")
	if s ="" then 
	msgbox "But..."& vbnewline &"it's empty"
	exit sub
	end if

	ss =inputbox("Where to export HUL?","HUL",s & ".OUT")
	
  
	if ss =".out" then 
	msgbox "But..."& vbnewline &"it's empty"
	exit sub
	end if
if you are not sure ( :blink: ) what am I talking about maybe just download them from the server:
- Hul2txt.vbs
- txt2hul
^^ and thanks again, SkindUpTruk, your tool is so far one of the best :D

Posted: 27 Mar 2009, 22:30
KDL
Here I'm presenting a GUI for HUL editor, it's a small effort compared to Skinduptruk's effort. All thanks go to SkindUp Truck



version: 1.1 beta
Download link
Mirror 1
(Dependies:Richtextbox and common dialog components)

Edit: Fixed link twice and added dependies file download

Posted: 17 Jul 2009, 05:23
zipperrulez
download links dont work kay, try box.net

Posted: 17 Jul 2009, 20:48
KDL
oh, I'm making a 3D hull editor right now :)
if you can't wait... I'll reupload it soon

Posted: 05 Aug 2009, 17:20
KDL
Hello guys
I was trying to understand what does that unknown vector

Code: Select all

unkcom 0.008
unkcom -24.229
unkcom 1.929
does ( using Re-Volt source code [RVDEV] and Ali's Hull Brakedown)

In fact, Ali has made a small mistake

Code: Select all

Vector   unknown_vector;
that's the most important vector for a HULL.
in fact, here how does a hull (spheres+bbox) looks like (com:0,-24,1)


and here is UFO with the CoM almost (0,0,0)


so according to Re-Volt source, BBOX is
BBOX structure wrote:typedef struct {

REAL XMin, XMax;
REAL YMin, YMax;
REAL ZMin, ZMax;

} BBOX;
General HULL structure wrote:typedef struct ConvexStruct{

INDEX NPts;   // Number of points
INDEX NEdges;   // Number of edges
INDEX NFaces;   // Number of faces

BBOX BBox;   // Axis-aligned tight bounding-box
VEC Offset;   // Offset of bounding box from body's CoM

VERTEX *Pts;   // collision skin corners (stored relative to body CoM)
EDGE *Edges;   // array of 2 element arrays giving index of edge vertices
PLANE *Faces;   // array of 4 element arrays giving indices of face corvers

} CONVEX;
so? what's the conclusion
the unkCom, or OFFSET Matrix is just a mirror-alike

regards, Falcon

Posted: 05 Aug 2009, 18:30
SkindupTruk
Hi KDL, nice to see you are still interested! It's lucky I saw this thread so quickly, I was just skimming thru tonite...

As for this code

Code: Select all

VEC Offset;   // Offset of bounding box from body's CoM
I didn't see these comments before. From reading it just now, it appears to make sense that these numbers are a vector that gives you the distance from the BBOX to the COM or "Center Of Mass" of the actual car. ie. when you "lower" a car, you are lowering the COM to make it more responsive

COM on wiki

However I notice that the y value is negative, where I thought it might be positive given the BBOX will be under the car's COM, and that the y axis is defined to be positive downwards into the ground.

Therefore it might be the offset of the body's COM from the BBOX rather than vice versa as above? just guessing. try reducing this value and the car might get more responsive (like a lowered sportscar)??? increase it and it might get top heavy (like the ambulance from GTA3 :) ) ???

Posted: 06 Aug 2009, 01:42
KDL
ah about CoM I found how does it work exactly
it's the com of BBOX as my last tests

thx SkindUpTruk :)

edit: the bbox is the one that need to be redimensioned

Posted: 07 Aug 2009, 01:01
urnemanden
From all the English-Encrypted language you are writing I understood the very good news in this. I appreciate that both of you is working on this and even though I understand 0 of just a cars parameter, I still am interrested in how .hul can be modified and how the differences appear as from .ncp

Continue the good work!

Posted: 17 Jan 2010, 03:02
zagames
Just a little update, I stumbled on ali/gabor varga's old website if anyone was interested. Here's a page featuring the Hul file description. Hope it helps,
Zach

Link: http://www.perror.de/rv/hulls/index.html

Posted: 17 Jan 2010, 05:46
human
please delete this post of mine, it was off topic.