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.

Dark GDK / Looking for the speed of the object

Author
Message
Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 16th Feb 2008 07:59
ive been looking at this code for quite a while now and i cant seem to understand where would the code for the speed of the object is. care to explain?



the code is from starsky's collision example
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 16th Feb 2008 17:34


This seems to determine the speed of the object...well actually, it's just calculating the object's new position. The speed is not coded in this function, it's only used. In this example, that speed is 1. You can tell by the fact that there's no actual mention of speed in the code above, which would be the part to use speed, and that means it's only going 1 unit in any direction.

If you want the object's speed to be 5, then in parts like these

you would add *[your speed variable] to it, multiplying the 1-unit speed by our speed.

The snippet above gives the X-Z movement vector for any object traveling at speed S.

Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 17th Feb 2008 07:37
thanks! ive been trying a lot of work-around by making something move without help of a physics sdk
Kira
16
Years of Service
User Offline
Joined: 25th Jan 2008
Location:
Posted: 19th Feb 2008 10:04
new problem. ive replaced this code



with this code

(i know it's a sorry excuse for an accelerating object but i just want to show or did a work around for acceleration since im running out of time)

but to my surprise, the sphere goes through the walls occasionally at a certain speed. ive initialized acc for double btw (if anyone asked)

what to do kind sirs?

Login to post a reply

Server time is: 2024-11-17 06:39:29
Your offset time is: 2024-11-17 06:39:29