Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dr_panther), 1,282 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how can i detect if a position of a vector is an empty space? #299972
11/28/09 16:18
11/28/09 16:18
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Guys, suposse i want to create an entity in a x,y,z point
but before that, i would like to know if that specific point is empty, not filled with other entity or wall.

I think it is possible, but for now i dont know how

Re: how can i detect if a position of a vector is an empty space? [Re: Erick_Castro] #299974
11/28/09 16:36
11/28/09 16:36
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
you can use:

c_content(VECTOR* pos,var mode)
Checks the block material at the position given by the vector. The instruction returns a value of CONTENT_EMPTY (1) if empty space, CONTENT_PASSABLE (2) if a passable block, or CONTENT_SOLID (3) if a solid block is detected at the given position. Blocks in the level as well as in map entities are detected - but no other entities. You is set to the entity detected at the position, if any.


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: how can i detect if a position of a vector is an empty space? [Re: painkiller] #299983
11/28/09 17:54
11/28/09 17:54
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Excelent, paint killer.

My idea is to program an entity , for example a floating enemy saucer, that generate in to a room different and random vectors and fly to that random vectors, but test the vectors before the saucer fly to them. In that way, we would have an enemy saucer that can fly free and randomly and realistic because it never impacts any wall for accident, and the player cant predict the next position of the enemy.

Thanks.

Last edited by Erick_Castro; 11/28/09 17:58.
Re: how can i detect if a position of a vector is an empty space? [Re: Erick_Castro] #300012
11/28/09 21:56
11/28/09 21:56
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
From the manual: Don`t use c_content for newer projects...

Re: how can i detect if a position of a vector is an empty space? [Re: Widi] #300019
11/28/09 23:03
11/28/09 23:03
Joined: Mar 2009
Posts: 88
Walori Offline
Junior Member
Walori  Offline
Junior Member

Joined: Mar 2009
Posts: 88
Quote:
From the manual: Don`t use c_content for newer projects...


this

And even if you would use c_content think it wouldn't really serve its purpose; there still might be entites a bit further from the c_content positon. You should rather make a function that scans a position for a defined radious. THOUGH I can't remember if c_scan detects walls...

Re: how can i detect if a position of a vector is an empty space? [Re: Walori] #300024
11/29/09 00:24
11/29/09 00:24
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Widi, you are right, better i use c_trace or c_scan to make that.
I will study the way.

Thanks.

Re: how can i detect if a position of a vector is an empty space? [Re: Erick_Castro] #300029
11/29/09 02:04
11/29/09 02:04
Joined: May 2009
Posts: 258
Chicago
J
Jaeger Offline
Member
Jaeger  Offline
Member
J

Joined: May 2009
Posts: 258
Chicago
There's another way, which MIGHT be more efficient than constant scanning. However, I've NEVER done any benchmarking on Lite-C instructions, so I'm not sure how fast/slow (exactly) things are. The manual does give a bit of a guideline though.

What I would do is create a bounding frustrum (invisible) for the point in 3D space I want to monitor and check. That could simply be an invisible primitive (like a cube). Then I'd create an event handler for an object entering its bounds, and object leaving its bounds. The simplest way of handling the event is to set a bool true/false. However, I would take that a step further. I know I can do it in C#, but not sure if you can in Lite-C or even in 3DGS A7 at all... but, I would create a "bit flag" enumeration to get more detailed data about the state.

For example: myEnum ^= StateEnum.Entity;

Yeah, that's C#-ish, but hopefully you catch my drift. I haven't used Lite-C in ages, so I can't give a working example in it. But if these features aren't present, hopefully they shall be SOON! laugh

Note: My example is a bit contrived; and by MY interpretation of the problem you presented. It might be a silly idea if you need to get the state of any arbitrary/random vector3 at any given time. This would just work well for a FIXED position, or one that moves infrequently. If your point will be any random vector3 in 3D space, you'd better use scanning. But if there's any way to use matrices in Lite-C/A7, that would be even better; but I think it shields you from all the underlying DirectX stuff (that I <3, heheh).

Re: how can i detect if a position of a vector is an empty space? [Re: Jaeger] #300175
11/30/09 12:06
11/30/09 12:06
Joined: Mar 2009
Posts: 207
E
Erick_Castro Offline OP
Member
Erick_Castro  Offline OP
Member
E

Joined: Mar 2009
Posts: 207
Thank for all your answers , friends.

for now i am thinking to use c-trace and , Jaeger , i will think about to make an idea like yours in Lite-C.

Thanks again.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1