Jump to content


Photo

Precise 3D Collisions Dll (P3Dc.Dll)


  • Please log in to reply
390 replies to this topic

#31 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 26 October 2009 - 02:17 AM

Just a suggestion: Paint.NET is amazing for the price (free).
For the ellipsoid, it may be nice to have a mathematically "perfect" check as well. That would be easier that generating a model, but would also obviously not match a very low-poly gm ellipsoid.

Edited by hanson, 26 October 2009 - 03:28 AM.

  • 0

#32 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 26 October 2009 - 02:59 AM

@hanson.
I'll look into Pain.NET (or did you mean paint.net?)


I've actually already added a perfect ellipsoid check (comparing distance between the two points to the radius of the model and ellipsoid); however it is not in this version. I added it about 2 hours after I uploaded it. Thanks for the suggestion though.

[EDIT]
I think you meant paint.net (that's what I'm getting right now). Thanks
[/EDIT]


~Brett14;

Edited by brett14, 26 October 2009 - 03:02 AM.

  • 0

#33 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 26 October 2009 - 03:47 AM

Yes, I meant paint.net - sorry 'bout that

keep up the good work!
-hanson
  • 0

#34 Robert3DG+

Robert3DG+

    Designer

  • GMC Member
  • 1925 posts
  • Version:GM:Studio

Posted 27 October 2009 - 01:23 AM

I'm already a wicked ace with building levels out of cones and cylinders and stuff so if Brett gets that example made I should have a real good platforming game tech demo made in return :)

Seriously, this .DLL should be an essential in every 3D GameMaker game. It fully deserves that title. With ellipsoids on the way and possible rotations in the future it really only get's better from here!
  • 0

#35 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 27 October 2009 - 03:35 AM

Might be at the end of this week though (or even the start of next week), I'm swamped with school, sports, homework, and activities throughout the week. And my weekend is all taken up with Halloween, Paintball, Soccer etc. Not much free time lately, and I'm also working on a few projects so I'll try and get a new version and example up ASAP, however like said before it might be about a week (or a little longer).

Sorry 'bout that...
~~Brett14;

Edited by brett14, 27 October 2009 - 03:36 AM.

  • 0

#36 Robert3DG+

Robert3DG+

    Designer

  • GMC Member
  • 1925 posts
  • Version:GM:Studio

Posted 28 October 2009 - 02:36 AM

That's quite alright, I'm in the middle of trying to figure out how to do it myself.

I get how you must set up the invisible collision model and then draw the actual visual representation of it, the only confusing part is making the player be able to collide with every geometry piece I throw in the world instead of doing one check on just one big collision model that was generated by one object (As it is in Example 1) as opposed to many like I need.

However I'm still experimenting and I'm liking what I'm seeing, and yeah, school can be annoying (Junior in High School this year =P)
  • 0

#37 oiioii

oiioii

    GMC Member

  • New Member
  • 50 posts

Posted 18 November 2009 - 11:23 PM

EXELENT improvement of the DLL
Thanks!!! The speed gets a waaay better!!! :)
Using in my game with HXS2007
  • 0

#38 RamboFox

RamboFox

    Tainted Fortune

  • New Member
  • 992 posts

Posted 22 November 2009 - 03:51 AM

This dll runs so much faster than ModMod - it's helping me heaps!

Just one thing; Is it possible to return a raycasted model's ID, and it's parent instance? (I would like to know whether, for example: My bullet hit the terrain, or an enemy character instead)
  • 0

#39 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 22 November 2009 - 10:00 PM

Yes, it is possible. Below is a [template] of how this would work. It may look like a lot, but most of it is comments, so it is actually quite simple. Use two variables, one to store the id of the hit object, and another to store the distance to it. These are the variables dis and hit.


dis=p3dc_ray_still(levelcolid,x,y,z,vx,vy,vz);//shoot to see how far it is to the level, Returns 0 if shot into space
hit=noone;//Currently we have shot nobody -> This will remain noone if nobody was shot.

//hit an enemy
with(obj_enemy){
var d;
d=p3dc_ray(global.bot_collision,x,y,z-5,other.x,other.y,other.z,other.vx,other.vy,other.
vz);//check to see if there was a collision with this player in the given direction
	if(d<other.dis){//if there was a collision AND it was less than the distance to the level
	other.dis=d;//The distance is now to this player (he's the closest)
	other.hit=id;//We set hit to this objects id, becuase we hit it.
	}
}
//hit an ally
with(obj_ally){
var d;
d=p3dc_ray(global.bot_collision,x,y,z-5,other.x,other.y,other.z,other.vx,other.vy,other.
vz);//check to see if there was a collision with this player in the given direction
	if(d<other.dis){//if there was a collision AND it was less than the distance to the level
	other.dis=d;//The distance is now to this player (he's the closest)
	other.hit=id;//We set hit to this objects id, becuase we hit it.
	}
}
//Repeat the above code for every object that you want to be able to be shot, or just make a parent and detect against it.

//************************************//
//****BELOW IS THE REACTION, ABOVE IS THE DETECTION****//
//************************************//


if dis==0 exit;//Nothing was hit, he shot into space

//We hit the level, do whatever
if(hit==noone){
//EFFECT
exit;//exit --> Needed, so it doesn't continue down to the code below
}

//We hit an object
with(hit){
//What to do with the hit object, for example kill it
instance_destroy();//<--Change this
}

Hope that helps you
~~Brett14;


[REASON FOR EDIT]
Adding more comments to the code, fixing it's format
[/EDIT]

Edited by brett14, 22 November 2009 - 10:05 PM.

  • 0

#40 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 25 January 2010 - 09:28 AM

This is a quick 3D collision dll. I'm very impressed! :medieval:
I do have a slight issue though.
I used this to make my first 3D First person shooter, and I used to get a solid 60/60 FPS.
But my project has moved to GM8, not GM7. And now I only get a maximum of 54/60 FPS.

Any ideas why?
Or maybe fixes to the dll?

-MoK
  • 0

#41 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 25 January 2010 - 07:31 PM

This is a quick 3D collision dll. I'm very impressed! :medieval:
I do have a slight issue though.
I used this to make my first 3D First person shooter, and I used to get a solid 60/60 FPS.
But my project has moved to GM8, not GM7. And now I only get a maximum of 54/60 FPS.

Any ideas why?
Or maybe fixes to the dll?

-MoK

Honestly, I don't think this would be a problem with my dll, but with your programming in GM8. <-- Guess?
Anyways I [might] come out with an update soon, however chances are minimal. (Unless I get any suggestions which would be worth adding)
  • 0

#42 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 26 January 2010 - 08:30 AM

Hm.. I just tried your examples with the dll, and found that it isn't the dll.
But the only problem it has is the difference in syntax (only two problems anyway).
I don't get why my game's performance has gone down :).

Anyway, now I see it is a good dll. Great job! ;)

-MoK
  • 1

#43 jackbbod2

jackbbod2

    GMC Member

  • New Member
  • 4 posts

Posted 07 February 2010 - 09:56 AM

im having a problem with my guy going up ramps. do you know anny ways to fixing this problem?
another thing what program did you use for the models

Edited by jackbbod2, 07 February 2010 - 10:07 AM.

  • 0

#44 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 07 February 2010 - 10:10 PM

im having a problem with my guy going up ramps. do you know anny ways to fixing this problem?
another thing what program did you use for the models

Sorry, I can't help you without code.

For the model, I used a model maker that I made, it's not public. It actually supports multiple textures etc., but I just applied one so that the file size didn't get overly large.

Edited by brett14, 07 February 2010 - 10:11 PM.

  • 0

#45 DmitriV

DmitriV

    GMC Member

  • GMC Member
  • 11 posts

Posted 12 February 2010 - 07:03 PM

Sorry, maybe it's a dumb question, but how do you export a model to .d3d of .map

I use 3ds max and I can export models to .3ds, .obj but not d3d and .map
And why is map_core.map just 2kb ??

Edit:

For the model, I used a model maker that I made, it's not public. It actually supports multiple textures etc., but I just applied one so that the file size didn't get overly large.

Oh and you could you please tell me how I can use multple textures and (advanced) uvmapping. Because when I want to create a complicate house a UV map won't help...

Edit:
Oh, and do you know a faster example of this. I mean something like this could be very helpfull with bullets, but your pointer in your example is maybe a bit too complicated but faster...
http://gmc.yoyogames...howtopic=366771

Edited by DmitriV, 12 February 2010 - 10:25 PM.

  • 0

#46 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 13 February 2010 - 12:01 AM

Sorry, maybe it's a dumb question, but how do you export a model to .d3d of .map

You can't. As stated before it is a custom model format that I had made (smaller and multitextured and faster collisions)

And why is map_core.map just 2kb ??

It's my custom model format, it's not public.

---------------------------------------------------------
Look at example 2, not 3. Three is for users who want to make collisions faster (however, it is much harder and requires a lot of effort on your part, or a custom model format). All you need is a .d3d model to load the model into collisions (it loads map_model.d3d) in example 2.


PS: People seem to be interested in how I made the map. I'm in the middle of making a map/dungeon maker (produces maps like the one in here) that are multitextured, and work easily with p3dc. I've modified P3DC.dll to work with it, however neither is released yet. I'm hoping to get a first beta out soon.

Edited by brett14, 13 February 2010 - 12:02 AM.

  • 0

#47 DmitriV

DmitriV

    GMC Member

  • GMC Member
  • 11 posts

Posted 13 February 2010 - 12:38 PM

Sorry, It was a dumb question. I can make d3d files (Marzipan and Model Creator). I forgot about that... :P

Will it support .3ds files in the future? I mean that would be great in combination with Ultimate3D! :lol:
I can't live with the speed of Game Maker :D , so I think I will do U3D the renderings...

Edited by DmitriV, 13 February 2010 - 12:44 PM.

  • 0

#48 MasterOfKings

MasterOfKings

    The True Master

  • GMC Member
  • 4888 posts
  • Version:GM8

Posted 20 February 2010 - 08:20 AM

No offense, but why are you using P3DC while using U3D? U3D has it's own built-in collision system.

-MoK
  • 0

#49 Drokokieo

Drokokieo

    GMC Member

  • GMC Member
  • 63 posts
  • Version:Unknown

Posted 26 February 2010 - 12:50 AM

http://www.box.net/shared/cdlyxi9b27

^
Testing a alternate model map.

Yeah, the collisions on this map is WAY off and doesn't seem to work correctly. Any suggestions?

NOTES:
I have edited the file. Open it on that. (Gm8. Sorry, I can't open up Game Maker 7 for some reason...)

Off Topic: Why do I see all of the posts in a list like way? I have to click them to see them. >_> Annoying.

Edited by Drokokieo, 26 February 2010 - 12:51 AM.

  • 0

#50 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 27 February 2010 - 05:22 AM

Okay, three suggestions (one answer, two suggestions)


Suggestion 1) I fixed the collisions, the reason was it happened was one of those stupid errors we all make (Well, two this time).

in the create event under the //Create a player collision model comment replace the three lines of code with this.
player_colid=p3dc_begin_model();
p3dc_add_block(-14,-14,-25,14,14,-20);
p3dc_end_model();
That will correctly define the collision model you wanted. You have to scale the size of you're collision model to fit in with the size of your map. In my example the map was only about 800x800 in size, where yours goes up into the 8000's


In the step event under if(p3dc_check_still(... replace the whole thing with this
if(p3dc_check_still(player_colid,tox,toy,z,level_colid)==1){
	if(p3dc_check_still(player_colid,x+lengthdir_x(0.2,tdir),y,z,level_colid)==0){
	x+=lengthdir_x(0.2,tdir);
	}
	if(p3dc_check_still(player_colid,x,y+lengthdir_y(0.2,tdir),z,level_colid)==0){
	y+=lengthdir_y(0.2,tdir);
	}
}else{
x=tox;
y=toy;
}
Your problem here was you were checking for a collision 25z positions under where you already were, remove that -3-25 and it was fixed.


Suggestion 2)
Use this as the move code (although not required)
//MOVE
if(keyboard_check(vk_left) or keyboard_check(ord('A'))){
x+=lengthdir_x(3.5*(keyboard_check(vk_shift)+1),direction+90);
y+=lengthdir_y(3.5*(keyboard_check(vk_shift)+1),direction+90);
}
if(keyboard_check(vk_right) or keyboard_check(ord('D'))){
x+=lengthdir_x(3.5*(keyboard_check(vk_shift)+1),direction-90);
y+=lengthdir_y(3.5*(keyboard_check(vk_shift)+1),direction-90);
}
if(keyboard_check(vk_up) or keyboard_check(ord('W')) or mouse_check_button(mb_right)){
x+=lengthdir_x(3.5*(keyboard_check(vk_shift)+1),direction);
y+=lengthdir_y(3.5*(keyboard_check(vk_shift)+1),direction);
//speed=3.5
}
if(keyboard_check(vk_down) or keyboard_check(ord('S'))){
x+=lengthdir_x(3.5*(keyboard_check(vk_shift)+1),direction-180);
y+=lengthdir_y(3.5*(keyboard_check(vk_shift)+1),direction-180);
}

Suggestion 3)
Remove the unneeded polygons from your map, you're using blocks for everything including walls, so you only see 2/12 of the polygons on the cube. If you removed them You would get massive speed improvments (probably up to about 3-4x faster). I'm only getting 23 fps while running your map, and I get up to 230 running mine and there isn't a huge difference in visible polygons - because I removed unseen ones.

Edited by brett14, 27 February 2010 - 05:23 AM.

  • 0

#51 Drokokieo

Drokokieo

    GMC Member

  • GMC Member
  • 63 posts
  • Version:Unknown

Posted 27 February 2010 - 03:44 PM

Thanks. I really needed that.

I guess I have to explain about the map model as well...

CODE FROM REAL GAME: obj_camera - Alarm 0 Event - Works - Speed = efficient.
[codebox]p3dc_clear_model(level_colid);
//Create a player collision model
player_colid=p3dc_begin_model();
p3dc_add_block(-16,-16,z,+16,+16,z+48);
p3dc_end_model();


//Reset all variables that add collision models...
obj_camera.fct=0
obj_camera.rct=0
obj_camera.bct=0
obj_camera.hfct=0

//Begin Model making and add floors, walls, ramps, etc. to the map collision model.
level_colid=p3dc_begin_model();
with (marker_floor)
{
obj_camera.floorcollisionsx[obj_camera.fct]=x
obj_camera.floorcollisionsy[obj_camera.fct]=y
obj_camera.floorcollisionsz[obj_camera.fct]=z
obj_camera.fct+=1
}
for (o=0; o<obj_camera.fct; o+=1)
{
p3dc_add_block(obj_camera.floorcollisionsx[o]-32,obj_camera.floorcollisionsy[o]-32,obj_camera.floorcollisionsz[o]-1,obj_camera.floorcollisionsx[o]+32,obj_camera.flo
orcollisionsy[o]+32,obj_camera.floorcollisionsz[o])
}
with (marker_block)
{
obj_camera.blockcollisionsx[obj_camera.bct]=x
obj_camera.blockcollisionsy[obj_camera.bct]=y
obj_camera.blockcollisionsz[obj_camera.bct]=z
obj_camera.blockcollisionsrot[obj_camera.bct]=dire
ction
obj_camera.bct+=1
}
for (o=0; o<obj_camera.bct; o+=1)
{
if blockcollisionsrot[o]=0 or blockcollisionsrot[o]=180
{
p3dc_add_wall(obj_camera.blockcollisionsx[o]-32,obj_camera.blockcollisionsy[o],obj_camera.block
collisionsz[o],obj_camera.blockcollisionsx[o]+32,ob
j_camera.blockcollisionsy[o],obj_camera.blockcollis
ionsz[o]+64)
}
else
if blockcollisionsrot[o]=90 or blockcollisionsrot[o]=270
{
p3dc_add_wall(obj_camera.blockcollisionsx[o],obj_c
amera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o],obj_camera.blockcollisionsy[o]+32,ob
j_camera.blockcollisionsz[o]+64)
}
else
if blockcollisionsrot[o]=45 or blockcollisionsrot[o]=225
{
p3dc_add_wall(obj_camera.blockcollisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64)
}
else
if blockcollisionsrot[o]=135 or blockcollisionsrot[o]=315
{
p3dc_add_wall(obj_camera.blockcollisionsx[o]+32,ob
j_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]-32,obj_camera.blockcollisionsy[o]+32,obj_camera.bl
ockcollisionsz[o]+64)
}
else
{
p3dc_add_block(obj_camera.blockcollisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64)
}
}

with (marker_half_floor)
{
obj_camera.hfloorcollisionsx[obj_camera.hfct]=x
obj_camera.hfloorcollisionsy[obj_camera.hfct]=y
obj_camera.hfloorcollisionsz[obj_camera.hfct]=z
obj_camera.hfloorcollisionsrot[obj_camera.hfct]=di
rection
obj_camera.hfct+=1
}
for (o=0; o<obj_camera.hfct; o+=1)
{
if hfloorcollisionsrot[o]=0
{
p3dc_add_triangle(obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]+32,obj_camera.hfloorcollisionsz[o]
)
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
if hfloorcollisionsrot[o]=90
{
p3dc_add_triangle(obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o])
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
}
else
if hfloorcollisionsrot[o]=180
{
p3dc_add_triangle(obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]+32,obj_camera.hfloorcollisionsz[o]
)
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
if hfloorcollisionsrot[o]=270
{
p3dc_add_triangle(obj_camera.hfloorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o],
obj_camera.hfloorcollisionsx[o]+32,obj_camera.hflo
orcollisionsy[o]+32,obj_camera.hfloorcollisionsz[o]
)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
{
p3dc_add_block(obj_camera.blockcollisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64)
}

}
with (marker_ramp) //Now for the complicated S**T.
{
obj_camera.rampcollisionsx[obj_camera.rct]=x
obj_camera.rampcollisionsy[obj_camera.rct]=y
obj_camera.rampcollisionsz[obj_camera.rct]=z
obj_camera.rampcollisionsrot[obj_camera.rct]=direc
tion
obj_camera.rct+=1
}

with (obj_ramp_parent_x) //Now for the complicated S**T.
{
obj_camera.rampcollisionsx[obj_camera.rct]=x
obj_camera.rampcollisionsy[obj_camera.rct]=y
obj_camera.rampcollisionsz[obj_camera.rct]=z
obj_camera.rampcollisionsrot[obj_camera.rct]=direc
tion
obj_camera.rct+=1
}

with (obj_ramp_parent_y) //Now for the complicated S**T.
{
obj_camera.rampcollisionsx[obj_camera.rct]=x
obj_camera.rampcollisionsy[obj_camera.rct]=y
obj_camera.rampcollisionsz[obj_camera.rct]=z
obj_camera.rampcollisionsrot[obj_camera.rct]=direc
tion
obj_camera.rct+=1
}

for (o=0; o<obj_camera.rct; o+=1)
{
if rampcollisionsrot[o]=0
{
p3dc_add_floor(obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)
p3dc_add_floor(obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o])
p3dc_add_wall(obj_camera.rampcollisionsx[o],obj_ca
mera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)


p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]-32,obj_camera.rampcollisionsz[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]+32,obj_camera.rampcolli
sionsz[o],
obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]+32,obj_camera.ra
mpcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]+32,obj_camera.rampcollisionsz[o]+32)
}
else
if rampcollisionsrot[o]=90
{
p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32,
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o]+128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32)

p3dc_add_floor(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o],obj_camera.rampcollisionsx[o],obj_
camera.rampcollisionsy[o]+32,obj_camera.rampcollisi
onsz[o])
p3dc_add_wall(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],obj_camera.rampcollisionsx[o]+32,obj_c
amera.rampcollisionsy[o],obj_camera.rampcollisionsz
[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o],
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o]+32
,obj_camera.rampcollisionsy[o],obj_camera.rampcolli
sionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o]+128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32)
}
else
if rampcollisionsrot[o]=270
{
p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32,
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o]-128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32)

p3dc_add_floor(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o],obj_camera.rampc
ollisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_
camera.rampcollisionsz[o])
p3dc_add_wall(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],obj_camera.rampcollisionsx[o]+32,obj_c
amera.rampcollisionsy[o],obj_camera.rampcollisionsz
[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o]+32
,obj_camera.rampcollisionsy[o],obj_camera.rampcolli
sionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o]-128,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+32,obj_camera.rampco
llisionsy[o],obj_camera.rampcollisionsz[o]+32)
}
else
if rampcollisionsrot[o]=180
{
p3dc_add_floor(obj_camera.rampcollisionsx[o]+128,o
bj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)
p3dc_add_floor(obj_camera.rampcollisionsx[o]+128,o
bj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o])
p3dc_add_wall(obj_camera.rampcollisionsx[o],obj_ca
mera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)


p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]+128,obj_camera.rampc
ollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]-32,obj_camera.rampcollisionsz[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]+32,obj_camera.rampcolli
sionsz[o],
obj_camera.rampcollisionsx[o]+128,obj_camera.rampc
ollisionsy[o]+32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]+32,obj_camera.rampcollisionsz[o]+32)
}
else
{
p3dc_add_floor(obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)
p3dc_add_floor(obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o])
p3dc_add_wall(obj_camera.rampcollisionsx[o],obj_ca
mera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32)


p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]-32,obj_camera.rampcollisionsz[o]+32)

p3dc_add_triangle(obj_camera.rampcollisionsx[o],ob
j_camera.rampcollisionsy[o]+32,obj_camera.rampcolli
sionsz[o],
obj_camera.rampcollisionsx[o]-128,obj_camera.rampcollisionsy[o]+32,obj_camera.ra
mpcollisionsz[o],
obj_camera.rampcollisionsx[o],obj_camera.rampcolli
sionsy[o]+32,obj_camera.rampcollisionsz[o]+32)
}
}

p3dc_end_model();

if global.shadows_and_other_effects=1
{
//When this is turned on, Ultimate 3D will enable it's special effects while GM Newton will add realistic physics.
//This will boost preformance and boost popularity of the game dearly.

//First make model...
d3d_model_destroy(global.level_model)
global.level_model=d3d_model_create()
for (o=0; o<obj_camera.fct; o+=1)
{
d3d_model_block(global.level_model,obj_camera.floo
rcollisionsx[o]-32,obj_camera.floorcollisionsy[o]-32,obj_camera.floorcollisionsz[o]-1,obj_camera.floorcollisionsx[o]+32,obj_camera.flo
orcollisionsy[o]+32,obj_camera.floorcollisionsz[o],
1,1)
}

for (o=0; o<obj_camera.bct; o+=1)
{
if blockcollisionsrot[o]=0 or blockcollisionsrot[o]=180
{
d3d_model_wall(global.level_model,obj_camera.block
collisionsx[o]-32,obj_camera.blockcollisionsy[o],obj_camera.block
collisionsz[o],obj_camera.blockcollisionsx[o]+32,ob
j_camera.blockcollisionsy[o],obj_camera.blockcollis
ionsz[o]+64,1,1)
}
else
if blockcollisionsrot[o]=90 or blockcollisionsrot[o]=270
{
d3d_model_wall(global.level_model,obj_camera.block
collisionsx[o],obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o],obj_camera.blockcollisionsy[o]+32,ob
j_camera.blockcollisionsz[o]+64,1,1)
}
else
if blockcollisionsrot[o]=45 or blockcollisionsrot[o]=225
{
d3d_model_wall(global.level_model,obj_camera.block
collisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64,1,1)
}
else
if blockcollisionsrot[o]=135 or blockcollisionsrot[o]=315
{
d3d_model_wall(global.level_model,obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]-32,obj_camera.blockcollisionsy[o]+32,obj_camera.bl
ockcollisionsz[o]+64,1,1)
}
else
{
d3d_model_block(global.level_model,obj_camera.bloc
kcollisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64,1,1)
}
}

for (o=0; o<obj_camera.hfct; o+=1)
{
if hfloorcollisionsrot[o]=0
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]+32,obj_camera.hfloorcollisionsz[o])
d3d_model_primitive_end(global.level_model)
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
if hfloorcollisionsrot[o]=90
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_primitive_end(global.level_model)
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
}
else
if hfloorcollisionsrot[o]=180
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]+32,obj_camera.hfloorcollisionsz[o])
d3d_model_primitive_end(global.level_model)
//d3d_vertex_normal_texture(x-32,y-32,z,x-32,y-32,z,0,0)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
if hfloorcollisionsrot[o]=270
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]-32,obj_camera.hfloorcollisionsy[o]+32,obj_camera.h
floorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]-32,obj_camera.hfloorcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.hfl
oorcollisionsx[o]+32,obj_camera.hfloorcollisionsy[o
]+32,obj_camera.hfloorcollisionsz[o])
d3d_model_primitive_end(global.level_model)
//d3d_vertex_normal_texture(x-32,y+32,z,x-32,y+32,z,1,0)
//d3d_vertex_normal_texture(x+32,y-32,z,x+32,y-32,z,0,1)
//d3d_vertex_normal_texture(x+32,y+32,z,x+32,y+32,z,
1,1)
}
else
{
d3d_model_block(global.level_model,obj_camera.bloc
kcollisionsx[o]-32,obj_camera.blockcollisionsy[o]-32,obj_camera.blockcollisionsz[o],obj_camera.block
collisionsx[o]+32,obj_camera.blockcollisionsy[o]+32
,obj_camera.blockcollisionsz[o]+64,1,1)
}
}


for (o=0; o<obj_camera.rct; o+=1)
{
if rampcollisionsrot[o]=0
{
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o],1,1)
d3d_model_wall(global.level_model,obj_camera.rampc
ollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-128,obj_camera.rampcollisionsy[o]+32,obj_camera.ra
mpcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
}
else
if rampcollisionsrot[o]=90
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o]+12
8,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o],obj_camera.rampcollisionsx[o],obj_
camera.rampcollisionsy[o]+32,obj_camera.rampcollisi
onsz[o],1,1)
d3d_model_wall(global.level_model,obj_camera.rampc
ollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],obj_camera.rampcollisionsx[o]+32,obj_c
amera.rampcollisionsy[o],obj_camera.rampcollisionsz
[o]+32,1,1)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]+128,obj_camera.ra
mpcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o]+12
8,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
}
else
if rampcollisionsrot[o]=270
{
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o],obj_camera.rampc
ollisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_
camera.rampcollisionsz[o],1,1)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o],obj_camera.rampcollisionsx[o]+32,obj_c
amera.rampcollisionsy[o],obj_camera.rampcollisionsz
[o]+32,1,1)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-32,obj_camera.rampcollisionsy[o],obj_camera.rampco
llisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o]-128,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+32,obj_camera.rampcollisionsy[o],ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
}
else
if rampcollisionsrot[o]=180
{
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]+128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]+128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o],1,1)
d3d_model_wall(global.level_model,obj_camera.rampc
ollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]+128,obj_camera.rampcollisionsy[o]+3
2,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
}
else
{
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_floor(global.level_model,obj_camera.ramp
collisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o],1,1)
d3d_model_wall(global.level_model,obj_camera.rampc
ollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o],obj_camera.rampco
llisionsx[o],obj_camera.rampcollisionsy[o]+32,obj_c
amera.rampcollisionsz[o]+32,1,1)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-128,obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]-32,obj_camera.rampcollisionsz[o]+32)
d3d_model_primitive_begin(global.level_model,pr_tr
ianglefan)
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o]-128,obj_camera.rampcollisionsy[o]+32,obj_camera.ra
mpcollisionsz[o])
d3d_model_vertex(global.level_model,obj_camera.ram
pcollisionsx[o],obj_camera.rampcollisionsy[o]+32,ob
j_camera.rampcollisionsz[o]+32)
d3d_model_primitive_end(global.level_model)
}
}

mapmodel=string_copy(mappath,0,string_length(mappa
th)-4)
d3d_model_save(global.level_model,"models/level_models/"+string(mapmodel)+".d3d")
d3d_model_destroy(global.level_model)
//Okay, so you're wondering why this saves a model.
//Well it's simple. During Debug sessions, I must also save the map as a model for backup purposes.
//This way, if the P3DC stops working... I can just tell it to open the model instead of all of the wall and floors.

//A faster possibility, but I wish to go slow. ^_^

}
else
{
}
alarm[6]=2
[/codebox]

^ This extremely long piece of code makes all of the walls, floors, ramps, and other triangles into one big model. That explains how this happened with unnecessary triangles.
  • 0

#52 DmitriV

DmitriV

    GMC Member

  • GMC Member
  • 11 posts

Posted 20 March 2010 - 09:10 PM

No offense, but why are you using P3DC while using U3D? U3D has it's own built-in collision system.

-MoK

But I like P3DC, it's easy and fast. So I want to know if there will be a .3ds file support in the future.
  • 0

#53 DmitriV

DmitriV

    GMC Member

  • GMC Member
  • 11 posts

Posted 20 March 2010 - 09:35 PM

No offense, but why are you using P3DC while using U3D? U3D has it's own built-in collision system.

-MoK

But I like P3DC, it's easy and fast. So I want to know if there will be a .3ds file support in the future.

Edit:I figured out how the collision checking system in U3D works. Actualy it's quite simple, you just need 5 lines of code. ;)

Edit:Still I would like to see P3DC with 3ds support. :GM8: U3D is bit buggy in my environment...



I noticed I've posted this message twice. Sorry, but that was my internet connection. So I pressed the submit button twice because he didn't load the page.

Edited by DmitriV, 20 March 2010 - 10:29 PM.

  • 0

#54 qwertyuiop23

qwertyuiop23

    GMC Member

  • New Member
  • 940 posts

Posted 21 March 2010 - 06:51 AM

Great DLL. Only one problem: Can't be used in Comp 05.

Two questions:

One: You going to release source at any stage?

Two: The triangle-triangle collisions between two models interest me as I am trying to port triangle-triangle collisions for any object to KingSpace.


You may be wondering why do that? Well Competition 5 states "NO DLLS" so yeah can't go with them. However kingspace when optimized is very quick with gm8.

Cheers
Lance
  • 0

#55 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 21 March 2010 - 01:13 PM

You can get the source for the original ModModCollisions at it's topic. In that same topic is a link to the code accompanying a paper by Tomas Moller on Triangle-Triangle intersections.
  • 0

#56 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 22 March 2010 - 03:26 AM

@qwertyuiop23
Use the link Hanson gave you. P3DC used about 95% of the math from modmod (Well I took it all and slightly modified a few peices). Modmod has everything in it you'll need to port the collision system to Gamemaker. HOWEVER BE WARNED: porting it to gamemaker will make it MUCH slower


@DmitriV - Sorry I didn't see you request a while back, if you give me a link to model format I should be able to add .3ds support.
[EDIT]Assuming a .3ds is not animated[/EDIT]


~~Brett14;

Edited by brett14, 22 March 2010 - 03:27 AM.

  • 0

#57 DmitriV

DmitriV

    GMC Member

  • GMC Member
  • 11 posts

Posted 23 March 2010 - 05:40 PM

if you give me a link to model format I should be able to add .3ds support.

A link to a model?
An example of a model format (extension)

What do you mean? And it was my fault, I've used P3DC and U3D collision checking. That works fine but not with both z-collision system's on. Now I use the U3D collision system only, but I must say the P3DC was great too!
  • 0

#58 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 24 March 2010 - 05:34 AM

I mean the model format, for example the model format of a .obj file (many programs allow for conversions) is this. Link to OBJ format; I couldn't find any for .3ds files... Here's another link to see how .obj files work.

Edited by brett14, 24 March 2010 - 05:35 AM.

  • 0

#59 Docopoper

Docopoper

    You are observant!

  • GMC Member
  • 1287 posts
  • Version:GM:Studio

Posted 24 March 2010 - 10:57 PM

DELETED

Edited by Docopoper, 28 May 2011 - 07:54 PM.

  • 0

#60 brett14

brett14

    GMC Member

  • GMC Member
  • 1151 posts
  • Version:GM8

Posted 25 March 2010 - 03:03 AM

@Docopop
If you don't mind I'll put that in the first post, thanks for making it (I'll give you credit). If you wish it to not be there I'll remove it.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users