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 / 3D race car game (Lighting)

Author
Message
xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 26th Oct 2005 06:51 Edited at: 27th Oct 2005 04:00
Im making a 3D race car game, and I have a few questions:

New Questions:
How do you use skyboxes? Not Completed
How can you set collisions with walls and such? Not Completed

OLD Questions:
How can I add darkness? Not Completed
How can I add lights to the 3d model car? Not Completed
How can I make the car speed up to a max speed if you hold up then when you release up it slowly slows down. Completed
How can I add braking where it lowers the speed down quickly to a stop? Completed

Thanks!
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 26th Oct 2005 23:07
1. I would use the set ambient light command

That will make the most defined shadows.

2. That's not a question.

3. Something along the lines of this


4. It would first be wise to set a maxspeed limit that you can change easily.


Then you would make a variable that would change based on the key inputs. It would make the speed# variable for speed go up or down depending if it is negative or positive. I would call it accel#. Then if upkey()=1 accel# = 0.1
if downkey()=1 accel# = -0.2
and then you would check to see if upkey and downkey is zero then accel# = -0.1

Then constantly update speed# with inc speed# , accel#

also make sure speed# never goes below zero


Then where you have the newxvalue and newzvalue commands for the position of the car change the step value to speed#.

5. Answered above.

xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 27th Oct 2005 00:58
I could not get the lights to work...
It said: You must link limbs in chain sequence.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 01:04
If you made the car model or got the car model and it already has attached limbs then you'll have to do some trial and error with the limb numbers to get them to work. What I would do is go everywhere where there is limb number 1 and 2 and replace those with variables called limb1 and limb2.

Then you can change those values until it doesn't give you the error. If there is a get total object limbs command that would be easier, but I don't know if a command like that exists.

xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 27th Oct 2005 01:29
The speed is also giveing me some problems could you add it to this code:
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 01:31 Edited at: 27th Oct 2005 01:32
I see the problem.

What you need to do is take look at your...



You need to change the value of 20.0 or -20.0 to speed#

If you did the acceleration right it will work fine.

Also you need to make sure you update speed during the main loop constantly with inc speed# , accel#

In addition to that I don't see anything about the accel# variable in the main loop.

xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 27th Oct 2005 01:47 Edited at: 27th Oct 2005 01:50
Actually there is a way to check how many limbs:



Even when I found the correct limbs the lights still didnt work...

and can you just add the code I need for the speed to mine?

Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 02:14 Edited at: 27th Oct 2005 02:14


I hope you can figure it out from this. It is not very difficult to understand. Post if you have any problems.

xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 27th Oct 2005 03:02
Now the movement works great after I did some changes, thanks!

But I still cant get the lights working.
The problems not the limbs now but they just dont show...
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 03:23
You may want to mess around with the outer and inner angles. Those are the numbers 36 and 45 I put there. you also may just want to get rid of the set light to object orientation command and just rotate the light on the y axis based on how you rotate the car.

Hope this helps.

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 27th Oct 2005 03:30
I dont understand. You have sync in your loop, but no 'Sync On' before the loop.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 03:34
@Xenocythe
It still works regardless. He could add it before the loop and it would work the same. The only difference would be something about displaying text. I can't remember the exact details but it does work without sync on.

xxdemzxx
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: CA
Posted: 27th Oct 2005 03:57
Yea, well still cant get it to work, I guess ill just leave it out for now.

But I have a few more questions:

How do you use skyboxes?
How can you set collisions with walls and such?

Thanks
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 27th Oct 2005 04:17
1. What I do for skyboxes is first I get a decent sky texture or something like that. Then I make a sphere with negative size. I texture the sphere with that texture and you have a "sky". There are other ways. For one thing if you have dark matter you can get the skyboxes or spheres from dark matter which are set up with uv mapping data of six textures. take the textures and object and put it into the folder with your source code/media folder/etc... and load the file.

2. Collision is a pretty complex part of programming. I'll give you some basic ideas and if you still need help make sure to ask.

What I would do first off is make some more limbs. offset the limbs to be infront , behind, the sides , front sides, back sides, wherever you think your model may end up hitting a wall.

You would do that by adding limbs to the object(as shown above) and using the offset limb command to move them around. You can hide the limbs with hide limb object number , limb number, but I wouldn't do that until your sure you know where the limbs are.

Now if you are using DBP you have the intersect object command.

What you would have to do is use the intersect object command to cast a ray from the object position to all the limb positions. So the more collision limbs you make the more intersect object commands you have to use. Then you check to see if the value of intersect object is greater than 0. If it is you'll have to adjust things like speed# for you car so it doesn't move through the walls.

If you have ANY questions about this ask. I understand that collision can be a daunting task for many and can also be hard to understand.

Login to post a reply

Server time is: 2024-11-27 14:24:21
Your offset time is: 2024-11-27 14:24:21