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 / How do I find the floor?

Author
Message
Raybrite2
15
Years of Service
User Offline
Joined: 16th May 2009
Location: Cyberspace
Posted: 28th Jun 2009 12:02
I am going through the movie tutorials with Dark Game Studio.
So far the camera position was way off from what they said and now I have a chair to place in the room.
I finally just used the camera position that I used to set it up.
this placed the chair in the room but up in the air.
I moved the numbers a bit an dhave lowered the chair to very close to the floor. Is there a command to place the object on the floor without guessing where it is?
Veron
17
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 28th Jun 2009 12:31
I suppose you could use raycasting, but It's way too much work just to position an object in a room, and a lot of code for many objects in the room as well. My advice is just to guess, I guess and get it spot on every time. If needed, you can obviously make alterations.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 28th Jun 2009 13:02


That should do the trick. Intersect object returns the distance to the point of intersection (if any, otherwise zero) between the line going between the specified positions and the specified object.

lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 28th Jun 2009 15:41
you could always look into darkphysics, that would drop it onto the floor like in real world gravity...

OR you could use a game editor like 3d world studio to build your 3d levels...

Come and have a look at my hobby site once your ready..
http://darkdstudio.webs.com/
Note: its still really bare..
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 28th Jun 2009 17:07
what you also could do without any intersect object command or something, is position the object at the height you want, and make a for loop that moves the object .01 down till collision occurs. then you just leave it like that, or you can print the solution so you can just type it in the ide.

Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 28th Jun 2009 23:21
I just made a function just like that, bobbel.

By changing the parameters, you can move an object along any axis, increasing or decreasing the value as necessary, and it will stop when it collides with the target object. It's not perfect (if you 'miss' it will go on forever), but it works, especially for 'floating' objects. I made it to place objects I made in Blender that tended to float when I positioned them. It's best used before you start your main loop.
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 29th Jun 2009 00:13
Looks nice, deego! and for the problem that it might miss and it goes on forever, you could add 2 parameters that specify between which points it should check for collisions.

zeroSlave
15
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 2nd Jul 2009 01:09
The missing the collision and going forever thing was a problem for me, so i devised a code such as:



Basically, when something is 'falling', it drops it on a much smaller scale in a FOR NEXT statement and grabs the initial moment that it connects.

I'm not sure if this code meets up with standard coding practices, but hopefully it gives an idea as to how i solved this dilemma.
zaxer thawl
16
Years of Service
User Offline
Joined: 29th Jan 2008
Location: Fredericksburg Texas
Posted: 3rd Jul 2009 02:19
and an easy fix for that would be to, instead of writing the position for each object without any linking, you can store 1 position in a variable such as "Floorposx" for the floors x position, and run the objects off of it.
like this:

floorposx as integer=0

paste object(replace this with chair number),floorposx + 50(or whatever),0,0

im sorry i didnt have time to edit this directly into your code, though.

Coreldraw Graphics suite X3 >>>>> Yes
Darkbasic pro >>>>> Yes

Login to post a reply

Server time is: 2024-09-28 08:33:07
Your offset time is: 2024-09-28 08:33:07