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 / Scrolling sky issues, and basic physics.

Author
Message
Wreckka
15
Years of Service
User Offline
Joined: 31st Jul 2009
Location: My grandmothers basement.
Posted: 28th Nov 2009 05:49 Edited at: 28th Nov 2009 05:50
Okay, I have a decent world set up right now for a game I'm making, but I've run into a few issues.

My first issue, is that I've tried a few different ways to get a scrolling sky effect and nothing seems to be working. The setup I have is that the matrix and all my objects are within a large inverted sphere, with a cloud texture stuck on it (The texture appears on the inside, which is why I inverted it). Now, all this is fine and dandy, but it just doesn't satisfy me. So I decided I'd try to make an x axis scrolling effect on the texture, so I put
Within the main loop. Now, this scrolled it, but it wasn't a continual scrolling effect. It just knocked it over 2.5 pixels. So then I thought about it for a little while, and got another idea. Rotate the sphere. So I put this within the main loop.
Once again, the image moved, but not continually. So now, I'm stumped, and I would prefer a quick easy solution.

My second issue is to do with physics/gravity (I think). I'm not even sure where to start with this one. I have a simple box as my character, and I was wondering if there was a way to lock my character to the matrix/landscape object, so that when I move up and down hills my character will move with the landscape. Here's the code I use for movement (From Xenoscythe's RPG tutprial), if that helps.


Any help is appreciated, thank you.

Making my way through life one line of code at a time...
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 28th Nov 2009 19:15
Rotating the sphere is correct, but you should be looking rotating the Y axis and at a much lower value than 2.5 degrees if it's in the main loop rather than being called via a timer.

You also need Wrapvalue(). If the object's angle value goes below 0 or above 359 then you get an error - hence the use of WrapValue().

Yrotate Object 999, WrapValue(Object Angle Y(999)+0.1)

(Place this just before your Sync line).

If you are using a matrix, then look up the command 'Get Ground Height'. This will tell you the height of the matrix at any X/Z position.

When you position an object, use the value returned by Get Ground Height and add a suitable value to it as the Y value of your object.

Note: The 'suitable value' will depend on the size of the object and for primitives like cubes and boxes is simply half of the object's height.

So, for the Y position of a 4x4x4 cube you would use:

Get Ground Height + 2.0

TDK

Wreckka
15
Years of Service
User Offline
Joined: 31st Jul 2009
Location: My grandmothers basement.
Posted: 28th Nov 2009 19:19
Thank you! *<:^D

Making my way through life one line of code at a time...

Login to post a reply

Server time is: 2024-09-28 12:27:43
Your offset time is: 2024-09-28 12:27:43