Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / combine 3 objects into 1 object

Author
Message
Canine FIsh
17
Years of Service
User Offline
Joined: 17th Jul 2007
Location: Australia
Posted: 20th Jul 2007 06:57
hi, i experiment 3 basic boxes and wanted to make them to 1 object, then saved them into dbo file since SAVE OBJECT command only use one object, try to use limb command but not sure how that will go about that, anyone figure this out?thanks...

`box1
make object box 1, 50, 50, 50
position object 1, 50, 0, 50
`box2
make object box 2, 50, 50, 50
position object 2, 60, 0, 60
`box3
make object box 3, 50, 50, 50
position object 3, 70, 0, 70

`make mesh from 3 boxes
make mesh from object 1,1
make mesh from object 2,2
make mesh from object 3,3

`add limb
add limb 1,1,1
add limb 1,2,2
add limb 1,3,3

`linking limb
link limb 1,1,2
link limb 1,1,3

`delete previos meshes
delete mesh 1
delete mesh 2
delete mesh 3
Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 20th Jul 2007 21:02 Edited at: 20th Jul 2007 21:32
1. Since all your boxes are the same dimensions, you don't have to make three of them. You can make one and make a single mesh that's added multiple times.

2. I suspect that you don't need a link limb command. You might - I don't know what you're doing - but you don't need it just to put three limbs together into one object.

3. I'm guessing that when you tried this it seemed that you were only getting one box. You need to use OFFSET LIMB commands using the relative positions of the boxes to position the limbs correctly. If you omit this step, the limbs will all be positioned at the same coordinates and since in this case the limbs are all the same size and shape, it will look like there's only one. Don't forget to use ROTATE LIMB commands to make sure each limb has the proper orientation.

Try this:



- Jane
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 21st Jul 2007 00:33 Edited at: 21st Jul 2007 00:34
I have another approach.

Basically, there is no need to make a mesh from object 1. That will be your base object, so don't do anytihng to it. You can add limbs (using the command ADD LIMB to the base object though. Just make meshes from the OTHER objects (in your case, objects 2 and 3), and then offset the new limb (using the OFFSET LIMB command) by the difference between the object from which the limb was made's position and the base object (object 1)'s position. OFFSET LIMB offset's a limb from the BASE OBJECT's position. So, it would look like something like this:



Note that MESH numbers and OBJECT numbers are in no way related to each other, and that limbs must be added in sequence (limb 1 first, then limb 2, then limb 3, etc.)

Hope this helped

Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 21st Jul 2007 10:16
Sixty Squares -

Your right. I was just trying to keep it simpler.

- Jane
Canine FIsh
17
Years of Service
User Offline
Joined: 17th Jul 2007
Location: Australia
Posted: 21st Jul 2007 13:06
Aha!!!It works!

i manage to save 3 objects into 1 object to dbo file. that is what i need. Many thanks. I use 3d model viewer to view my dbo file to see that it works, so here's the code:

sync on
sync rate 60
hide mouse

`setup camera
make camera 1
position camera 1,0,0,0
direction as float
pitch as float
direction = 0
pitch = 0

`box1
make object box 1, 50, 50, 50
position object 1, 50, 0, 50
`box2
make object box 2, 50, 50, 50
position object 2, 60, 0, 60
`box3
make object box 3, 50, 50, 50
position object 3, 70, 0, 70

`make mesh from 3 boxes
make mesh from object 2,2
make mesh from object 3,3

`add limb
add limb 1,1,2
add limb 1,2,3

`Offsetting the limbs
Offset Limb 1,1,object position x(2)-object position x(1),object position y(2)-object position y(1),object position z(2)-object position z(1)
Offset Limb 1,2,object position x(3)-object position x(1),object position y(3)-object position y(1),object position z(3)-object position z(1)

`delete previos meshes
delete mesh 2
delete mesh 3

`delete object 2 and 3
delete object 2
delete object 3

`save object to dbo
save object "test_save.dbo", 1
do
`camera mouselook
direction = wrapvalue(direction + (mousemovex()))
pitch = pitch - (mousemovey())
`make sure pitch reach only 90 degrees
if pitch > 90
pitch = 90
endif
if pitch < -90
pitch = -90
endif
`camera rotation
rotate camera 1, 0, direction, 0
pitch camera up 1, pitch
`move camera
if upkey() = 1
move camera 1,1
endif
if downkey() = 1
move camera 1,-1
endif


`move the box1 for testing
`press O
if scancode() = 24
move object 1, -1
endif
`press P
if scancode() = 25
move object 1, 1
endif

`clear screen
sync

loop
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 21st Jul 2007 17:05
@Jane: Oh okay. All I was doing was trying to stick to how Fish was using different meshes for each object. Hopefully both our posts will help out...

Login to post a reply

Server time is: 2024-09-27 02:22:45
Your offset time is: 2024-09-27 02:22:45