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 / Help with position object

Author
Message
Ben Hartnett
8
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 24th Dec 2013 20:38
Hello,
I've searched this board and cannot find any help in regard to my question. I am trying to position a sphere in a 3d environment and have the sphere not be able to go through the world. Wherever I position the sphere in code it stays in the same place and does not move. The camera is in 3rd person. Can someone tell me what I am doing wrong? I am trying to position the sphere but it does not position.

Here is my code:

smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 24th Dec 2013 21:56 Edited at: 24th Dec 2013 22:01
I don't have your example.x so I made a wall, obj#20 and set the collision check to(10,20)>0. The ball moves around and stops when it hits the wall. It doesn't go through anything, it seems to work right to me. I think your problem is your collision check is invalid u need a variable instead of a 0 to check against then u can run it through a loop and check lots of objects. just put rem in front of your collision line and the program works without collision. or check obj#10 against obj#6 your level. Try that if it doesn't work it might be a collision box issue with your map and u might want to manually control collision boxes.

A child's dream never dies.
smerf
14
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 24th Dec 2013 22:19
sorry took another look at your code kinda overlooked the obvious
just put "set object collision off 1" at line 19 your ball is colliding with the invisible collision box of your sky sphere.

to check it out "text 10,10,str$(Object collision(10,0))"
shows a collision of 1

A child's dream never dies.
Ben Hartnett
8
Years of Service
User Offline
Joined: 16th Dec 2010
Location:
Posted: 25th Dec 2013 00:46
I am still having problems with this. I can't position the object and the object won't move. I even removed the skysphere code and it still did not work. I tried using the code for setting the object collision off and it still did not work.
LBFN
12
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 25th Dec 2013 02:02
Hi Ben Hartnett,

I took a look at your code and made a few changes to make it work. I couldn't see through the player sphere, so I had it just show the wireframe. I created a cube for object #6 and colored the skysphere a purplish color. I put in a green box for the ground so you could see the player move. Take a look:



I wondered why the movement was slow and text flickered when printed on the screen and I noticed you set the sync rate without turning SYNC ON. Basically, this code looks at the position of the player's sphere prior to checking for collision. If it sees a collision, it puts it back where it was before. Also, I put in where you could simply back up if you run into something. It prints the value of COLLIDE so you can see the number of the object you are colliding with.

Hope this is helpful to you.

LB

So many games to code.....so little time.

Login to post a reply

Server time is: 2019-07-21 02:09:07
Your offset time is: 2019-07-21 02:09:07