Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
collision checking on many object; How can you use collision checking on many objects
Topic Started: Nov 12 2010, 10:05 PM (372 Views)
beniboy
This user has left
[ *  *  *  * ]
I am trying to work with ultimate 3D by editting the tech demo. But i have a problem:
I tried to apply collision checking with bounding boxses to make the trees solid. But when i did that I got less then 1 fps...
Is there a way to apply fast collision checking with many objects??
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
I suggest avoiding collision checks for objects in high numbers such as trees, it's a waste of frame rate and an unnecessary feature.
Offline Profile Quote Post Goto Top
 
beniboy
This user has left
[ *  *  *  * ]
Quote:
 
suggest avoiding collision checks for objects in high numbers such as trees, it's a waste of frame rate and an unnecessary feature.

And what if I realy want to do this?
Offline Profile Quote Post Goto Top
 
Despellanion
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Well you could replace the collision checks from directly on the tree model to simple collision checks on invisible boxes at the trees' positions, to decrease the computing time. And there's also no need to collision check the trees' crown, unless your player can fly. I'm sure there are several other options.
Edited by Despellanion, Nov 13 2010, 12:19 AM.
Offline Profile Quote Post Goto Top
 
beniboy
This user has left
[ *  *  *  * ]
Quote:
 
there's also no need to collision check the trees' crown, unless your player can fly

I added a helicopter...
Quote:
 
you could replace the collision checks from directly on the tree model to simple collision checks on invisible boxes at the trees' positions

Well... I tried invisible bounding boxes, but that was also WAY to slow
Edited by beniboy, Nov 13 2010, 12:32 AM.
Offline Profile Quote Post Goto Top
 
DJ-Habana
C# King
[ *  *  *  *  *  * ]
You can let a tree create his bounding box when the player is near and when he is far then delete the bounding box, that's what I do and it works like a bomb

for example pseudo code

if distance to character is less than 10 and bounding box doesn't exist then create bounding box
if distance to character is more than 10 and bounding box exist then delete bounding box
Posted Image


Offline Profile Quote Post Goto Top
 
hepolite
Advanced Member
[ *  *  * ]
I have solved this by putting all of my trees in lists, and depending on where the player is, hide/show the trees. The trees also have a small collision cone made out of three triangles which matches the tree's sizes and will be moved out of the collision room if the trees are no longer visible. This is the fastest way I could think of, and the game does run at a decent speed even with a vegetation count of more than 1,000 trees and bushes in the view + the entire level.
Edited by hepolite, Nov 13 2010, 03:42 PM.
Offline Profile Quote Post Goto Top
 
Naz
Member Avatar
Forum Leader
[ *  *  *  *  * ]
hepolite
Nov 13 2010, 03:33 PM
I have solved this by putting all of my trees in lists, and depending on where the player is, hide/show the trees. The trees also have a small collision cone made out of three triangles which matches the tree's sizes and will be moved out of the collision room if the trees are no longer visible. This is the fastest way I could think of, and the game does run at a decent speed even with a vegetation count of more than 1,000 trees and bushes in the view + the entire level.
BRAVO! :clapping:
May 20th, 2016
Offline Profile Quote Post Goto Top
 
beniboy
This user has left
[ *  *  *  * ]
i now use this code in the step event of the player:
Code: GML
 

if (room_index == 9){
var object_id;
for(i=0;i<forest.plant_count;i+=1){
if (point_distance(x,y,forest.plant_x[i],forest.plant_y[i]) <= 50){
object_id = instance_create(forest.plant_x[i],forest.plant_y[i],forest_bounding_box);
object_id.z = forest.plant_z[i];
AddObjectToRoom(object_id,9);
}
}
}

this code in the create event of the forest bounding box:
Code: GML
 

width=30;
height=100;
depth2=30;
originy=0.5;
originx=0.5;
partsz=10;
CreateCube();
SetObjectRoom(1999);
SetObjectSolidity(false,true);

and this code in the step event of the forest bounding box:
Code: GML
 

if (point_distance(x,y,character.x,character.y) > 100){
instance_destroy();
}

And it works!!!
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply