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 / Specific Questions about Collision Detection and Camera movement

Author
Message
MrSOP
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location:
Posted: 6th Apr 2006 17:59
Hello. I copied and pasted the code section I am on in the Monster Hunt tutorial. I put in bold the parts of the code related to the 2 questions I had. Please help.

1) I think I understand the code putting the object back where it was in the event of a collision. However, i am confused on how this code could exist on the first iteration of the loop where X# and Z# are not defined yet until the next line. Please help me understand. My understanding of the tutorial's explanation is that it is done this way to prevent the "position reset" from putting the object in a condition where it would collide with another object. Is this right?

2) For the camera movement, from changing the values in the aY#-180 part adjusts the camera's perspective. I thought that if I made that a variable

CamPos# = ay#-180

and then changed the value of this variable based on the spacebar push

if Spacekey()=1 then CamPos# + 1

and then plugged in CamPos# into the original equation in place of ay#-180 it would allow me to circle the object with the camera. However it says it cannot understand the CamPos# = ay#-180. What am I missing here? I would also guess that I may need to somehow include the wrapvalue command to CamPos#?! Is this correct?

Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 6th Apr 2006 20:15 Edited at: 6th Apr 2006 20:16
if Spacekey()=1 then CamPos# = CamPos# + 1

or

if spacekey() then inc CamPos#

or

if spacekey() then CamPos#=wrapvalue(inc(CamPos#))

inc stands for increment, using spacekey on its own is permissable since spacekey returns 1 (true) or 0 (false), and if/then is looking for an true/false condition, so spacekey() on its own will be either true or false and is all you need, pressed is true (=1), not pressed is false (=0)

unused variables in basic start with the value zero or null ("") in the case of strings, so the unused variables are actualy at zero on the first pass, in practice it`s best to explicitly set all your variables, but this is B.A.S.I.C, so you get quirks like that.



Dr Frankenstiens mum told him to make some new friends, not knowing where this was going to lead.
MrSOP
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location:
Posted: 6th Apr 2006 21:06
thank you very much!
MrSOP
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location:
Posted: 6th Apr 2006 21:28
One more question actually. I was having some trouble with the matrices section of Monster Hunter3D in DBPro. Basically, in a few places, the stated code would not work how I believed it would. For example, my 3rd person object (the sphere) would move over what appeared to be a flat matrix, but move up and down on "invisible hills" as it moved across the matrix.

Here is the code for the section in question:



After searching the forums for monster hunter, it appears that it does not work correctly in DBPro. Some poster actually said he made modifications for it to work in DBPro, and posted the updated tutorial on a page...that unfortunately no longer exists.

1) Would this problem be attributed to the difference in DBC and DBP, and what about the code would need to be changed in this section to achieve the same thing (a ball moving over a terrain with visible hills)?

2) I like the monster hunter tute, but if I am going to keep running into these type problems, is there a similar tutorial that you would recommend?
MrSOP
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location:
Posted: 6th Apr 2006 21:37
(sorry for the multiple posts...i didnt see an edit button or anything)

Never mind...I made a classic newbie mistake and didn't read everything thoroughly before posting. I will try out some of the terrain generators and some of the recommended tutes mentioned in the top post

sorry.

Login to post a reply

Server time is: 2024-09-24 19:24:44
Your offset time is: 2024-09-24 19:24:44