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.

DarkBASIC Professional Discussion / I'd liek to know how to find out if object is on screen

Author
Message
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 00:22
how do I find out if an object is on the screen? This is so I can hide it when it's not and speed up my program.
We could have handled that better.
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 5th May 2003 00:30
um..

Object In Screen()
Object Screen X()
Object Screen Y()

Next time READ THE MANUEL!

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
spooky
23
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 5th May 2003 00:31
there is command called 'object in screen'. Look it up in manual or help for full description.

Gronda, Gronda
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th May 2003 00:32
Use the OBJECT IN SCREEN command

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 00:33
Wow thanks I feal stupid though
Should have looked a little while longer neh?

We could have handled that better.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th May 2003 01:15
Yup

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 01:49
next question the clipping is really annoying how do I fix that?(big objects dissappear before they should...)

We could have handled that better.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th May 2003 02:09
Extend your camera range. SET CAMERA RANGE command

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 02:10
ok Thanks again!

We could have handled that better.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th May 2003 02:13
If it's still giving you jip, try SET CAMERA RANGE 0, 0.1, 50000, of course you can tailor the values to meet your world or scene size so that it doesn't ovwrwork the V.C.

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 02:13
that had no effect maybe I'm doing it wrong.... is it supposed to be
set camera range 1,15000

We could have handled that better.
MrTAToad
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 5th May 2003 03:41
Are you using camera 1 ?

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Oxygen
23
Years of Service
User Offline
Joined: 4th Feb 2003
Location:
Posted: 5th May 2003 03:42
The first camera is camera 0

APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th May 2003 03:46
Chainer, supply a small portion of the code that does it, just to see that we're understanding the problem correctly, if that's ok?

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 04:50
here ya go...

for optimizer = 3 to 22
if OBJECT IN SCREEN (optimizer)
show object optimizer
else hide object optimizer
endif

next optimizer

We could have handled that better.
rapscaLLion
23
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Canada
Posted: 5th May 2003 06:13
lol sorry I was a bit harsh before

Alex Wanuch
aka rapscaLLion
Kousen Dev Progress >> Currently Working On Editors
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 5th May 2003 06:28
Is ok, my lack of sense, neh?
RapscaLLion-sama don't worry, c'est karma.
Clipping's sure annoying though...

We could have handled that better.
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th May 2003 14:43
Chainer, when you refer to clipping, by extending your camera range, did it work? Is is clipping in the far distance or closer to the viewing plane (User's eye)?

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
Mentor
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 5th May 2003 16:36
I think he means the code he made to optimise the scene is deleting large objects before they have fully gone off the side of the screen, thats because the in screen function just gives the middle of the object, so as soon as the middle is off the screen his optimiser is deleting the object and you see it go before it is properly out of site, the way to solve this is to check if the width/height of the object is in screen, so instead of.....

if (object in screen (x))=0 then deleteobject(x)

you do something like

if (object screen x (x)-(width/2))>screenwidth or (object screen x(x)+(width/2)<0 then deleteobject (x)

and the same if you will have the objects in the verticle plain deleted as the camera pans up and down for the y direction, basicly you have to allow for the width of the object by adding that to the screen position before you test if it is offscreen, the other way is to have the scene rendered in on camera veiw and delete objects as they go off the edge and use another veiw for the game that is narrower, hence you wouldnt see what got clipped so long as it was small enough to be out of sight of the narrow feild before it was removed, but that means swapping views and might slow the game too much, cheers.

Mentor.

Kangaroo2
23
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 5th May 2003 21:11
Obvious point but it should be added that regardless of how far you set your draw distance, if your system isn't up to it it'll clip anyway.

Re: "Next time READ THE MANUEL!"

I would recommend everybody reads the MANUAL. Consulting MANUEL may not be the best idea, he never seemed to bright, what with thinking rats are "syberian hamster"s and all. *Whispers* he's from Barcelona, don't you know lol no offense Raps obv.

Coming Soon! Kangaroo2 Studio... wait and quiver with anticipation! lol
[email protected] - http://www.kangaroo2.com - If the apocalypse comes, email me
APEXnow
Retired Moderator
23
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 6th May 2003 01:01
LOL, And Manuel or always at faulty anyway

"Man who looses key to woman's appartment...... He get no nookie" - A wise chinese man.
aprilfan
23
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: Hell
Posted: 6th May 2003 03:37
thanks mentor I'll try that, it sounds like it will work and by "clipping" I was refering to the premature hideing of objects that are too large. So Domo,merci thanks!

We could have handled that better.

Login to post a reply

Server time is: 2026-07-11 08:46:35
Your offset time is: 2026-07-11 08:46:35