grouping things
Blitz3D Forums/Blitz3D Programming/grouping things
| ||
Maybe an odd question but... I am using linepick to determine whether the man is near to surrounding objects. If so then the followcamera distance changes to allow hom to rotate without the camera cutting through walls etc. It works very well except coding gets a bit tedious when entering a lot of objects. eg if p1=level1 then cameradistance =-2 if p1=door then cameradistance =-2 and so on. As there are a lot of meshes, is there a way to reference all of them as a "group" so that level1 and door and door1 and door2 etc can be entered as a single paramater in the above command. |
| ||
I think you should use Arrays or a type organisation for objects like doors and things. This way you can set up additional arrays easily, eg: n=1000 dim obj(n) dim obj_name$(n) dim obj_dis#(n) dim obj_group(n) obj_name$(0)="door24.3ds" obj(0)=loadmesh(obj_name$(0)) obj_dis#(0)=-2 obj_group(0)=1 Let's assume you have a lot of objects, all stored in the arrays, all you have to do is: for i=0 to last_obj if p1=obj(i) then cameradistance=obj_dis#(i) exit() endif next using arrays or types will also allow you to load a complete level from a file that lists the properties of each object. |
| ||
Thanks. I will give it a go. I did think of types but this may work better. |
| ||
Also use Collisions for the camera and the scenery to prevent the camera 'passing inside' walls etc. |