Cube and cyliner objects

Status
Not open for further replies.
Joined
9 Apr 2006
Messages
405
Location
London, UK
Hi,

Can someone teach me how to make a cube and cylinder objects without useing the addvertex statements please. Im working with CSV files.

Thanks
 
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
Have a look at the object creation guide on Luigi's site, here http://bve.altervista.org/guide.html

I work in .b3d, cos it's nice and simple (just like me!).

The level crossing gates and road surfaces in this screenshot were made as an exercise in using cube and cylinder commands... obviously, you build one crossing gate, then copy and paste it three times, shifting the copied parts using the "translate" command....



Regards

eezypeazy
 

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
That guide on Luigi's site is what I used to get a better understanding of object creation - it really is a great help and should be considered a 'must read'.

Only difficulties I have using the cube and cylinder commands is when applying rotation - might just be me but I do find this very tricky.

re the choice between .b3d and .csv formats - I've always tried to use .csv as allegedly these are quicker loading and drawing. No proof of this although there is one part of a route I am constructing which uses several arrays of 'easy trees' (which are .b3d objects) where the frame rate drops off quite dramatically. I will convert these eventually to .csv or even .x format to try and speed things up.

The other advantage of .csv over .b3d is that it is quicker to convert the files to .x format (unless anyone knows of a .b3d to .x converter), and .x files do have the advantage of being smaller and quicker to load (if compressed) and let you add more realistic lighting effects.
 

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
Dennis said:
there is one part of a route I am constructing which uses several arrays of 'easy trees' (which are .b3d objects)
If these are tree arrays constructed with the easyTREE tool: I gave up using this because the resulting file was too large and slow. It draws both faces of the trees, without using the face2 command; so the files could be made more efficient by manually deleting the unseen faces, but this is quite time consuming.

eezypeazy
 

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
You're right about it drawing both faces of the the trees, but that it why I chose to use 'easy tree' - by rotating the arrays it does not look like the same trees are appearing every 25m and retains a 3d look; less objects to load but more faces to draw.

I'll see about converting them to .x files and check what that does to the frame rates - what I've got does look good but it's no use if the route is undriveable due to 'stuttering'.
 

LondonBVE

Member
Joined
22 Dec 2005
Messages
441
Location
Lost!
Actually I approached EmergencyBrake on how to code tube and cylinder objects, then he replied he do not know. So I think he went and post it here, anyway just a little comment to dennis lance bve coding guide. Maybe dennis you can add one more tutorial call how to code a bve object.
 

Stooopid

Member
Joined
17 Jun 2005
Messages
70
Location
Planet Stooopid (5 Earth Seconds = 1 Stooopid Day)
An example, for a cylinder

CreateMeshbuilder,
Cylinder, 6, 0.1, 0.1, 0.2,
Translate, 5, 1, -4.2,
Rotate, 1,0,0,90,
SetColor, 255,0,0,
GenerateNormals,

Let's see if I can remember it correctly.
Cylinder, S, A, B, L,
S - the number of corners of a cylinder. The more, the smoother the circle, but more demanding on the computer.
A and B - the radii of the cylinder, one for each end, so you can actually make a cone shape with it.
L - the length of the cylinder.

Translate, X, Y, Z,
Movement along X, Y, Z axises.

Rotate, this I'm not very sure, but I believe the first 3 values are for X,Y,Z. 0 means no, 1 means yes. The last number is the rotation angle. If you specified yes for one of the axis, then you will be able rotate it that angle for that axis. I used trial and error for that part.

It's the same for cubes. Only you have the replace the word "Cylinder" with another word. Forgot what it was. Probably "cube".
 

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
LondonBVE said:
Actually I approached EmergencyBrake on how to code tube and cylinder objects, then he replied he do not know. So I think he went and post it here, anyway just a little comment to dennis lance bve coding guide. Maybe dennis you can add one more tutorial call how to code a bve object.

I was not intending to include object building because Luigi's guide is so good and these tutorials were to be about route building rather than object creation.

However, what I can do is when adding some of the objects, is to describe how they were made as a separate 'mini-tutorial'. Any specific objects you wish to be covered by this? (simple ones to start with!)
 

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
IIRC, for Cube you miss out the first number, because it knows a cube has 6 sides... and then the next three numbers are the width, height, length... otherwise I believe it's the same....

eezypeazy
 
Joined
9 Apr 2006
Messages
405
Location
London, UK
Thanks eezypeazy.

One more question, is it possible to apply a texture on it?

EDIT: I managed to apply a texture but appears slanted when I used the normal coords.
 

Simon_G

Member
Joined
19 Mar 2006
Messages
115
Stooopid said:
An example, for a cylinder
Rotate, this I'm not very sure, but I believe the first 3 values are for X,Y,Z. 0 means no, 1 means yes. The last number is the rotation angle. If you specified yes for one of the axis, then you will be able rotate it that angle for that axis. I used trial and error for that part.
I *think* the first three values in the rotate command are the x,y and z components of a vector that points along the axis about which you want to rotate. It's obviously much easier to use them as switches (i.e. either 1 or 0) like Stoopid says and probably best to rotate only about one axis at a time unless you're really sure what you're doing. I wonder if anyone has ever used them in the 'official' way!
 

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
EmergencyBrake said:
Thanks eezypeazy.

One more question, is it possible to apply a texture on it?

EDIT: I managed to apply a texture but appears slanted when I used the normal coords.

Yes, it's possible to apply textures, but you are right, one or more of the sides will not appear correctly... you must read the tutorial we pointed you to earlier, it's explained there... it is possible to apply textures to cylinders successfully, eg., brickwork on a chimney...

eezypeazy
 
Status
Not open for further replies.

Top