Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
5 registered members (Dico, AndrewAMD, TipmyPip, NewbieZorro, Grant), 16,707 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Highlighting bounding box #255636
03/11/09 16:19
03/11/09 16:19
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
After model creation and rotation, i set c_setminmax(me);
Then, i use standard function
Code:
function draw_bbox(ENTITY* ent)
{
	VECTOR vMin, vMax;  
	while(1)
	{
		vec_set(vMin,ent.x);
		vec_add(vMin,ent.min_x);    
		vec_set(vMax,ent.x);
		vec_add(vMax,ent.max_x);    
		draw_box3d(vMin,vMax,vector(0,0,255),100);    
		wait(1); 
	}
}


i use it in
Code:
void InitMouseEvent()
{
	while(1) {
		if(mouse_ent) {				
			if(mouse_left == 1) {
				ent_morph(mouse_ent,sHandleModelName);
				draw_bbox(mouse_ent);
			}




Why its so different? debugging bounding boxes are more correct than draw_bbox(), but last one also use ent.min_x... so why this trouble can come?

Last edited by VeT; 03/11/09 16:44.

1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Highlighting bounding box [Re: VeT] #255638
03/11/09 16:23
03/11/09 16:23
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
btw, on the top models(that are not rotated) this works perfect:



1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Highlighting bounding box [Re: VeT] #255648
03/11/09 18:05
03/11/09 18:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I think things are getting messy if your entity world co-ord goes negative.
Then that happens I think you need to swap placement of vMin and vMax.

Because draw_box3d expects the "from" parameter to be smaller than the "to" ??
Thats the way i read it..


[EDIT] My bad, complete lie. After testing the order of draw_box3d 1st & 2nd params doesnt matter.
BUT it doesnt take into account any rotation of the entity.
I have no idea how to get around that...


Last edited by EvilSOB; 03/11/09 18:38. Reason: Completely wrong!

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Highlighting bounding box [Re: EvilSOB] #255659
03/11/09 19:22
03/11/09 19:22
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Hi VeT,

if draw_box3d doesn't take rotation into account, like EvilSOB said, you have to translate the vectors you give to draw_box3d yourself before calling the function.

There are two practical ways of doing this.
The first one I can think of would be a rotation matrix which you multiply with the vectors.
The other would be quaternions.

I won't go into detail of these two methods now as this would be too much as well as other resources in the internet will explain it much better than I am able to. Just try to throw "rotation matrix" and "quaternion" into google.

Though I gotta warn you! These mathematics are anything but trivial!
Most probably there is a better solution for this problem though that's the only idea I got now.

greetings
KDuke

EDIT:
There just comes a resource into my mind which might be very worthy at this approach.
Game Physics Engine Development

Last edited by KDuke; 03/11/09 19:26.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Highlighting bounding box [Re: KDuke] #255663
03/11/09 19:40
03/11/09 19:40
Joined: Mar 2009
Posts: 40
MokyjeBrute Offline
Newbie
MokyjeBrute  Offline
Newbie

Joined: Mar 2009
Posts: 40
This is a hard one. I would "guess" that you should draw them by lines yourself! Maths is not hard, just use some vec_rotate for them!

Re: Highlighting bounding box [Re: MokyjeBrute] #255666
03/11/09 19:46
03/11/09 19:46
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Darn it!

I'm not really familiar with Lite-C (yet) so I didn't know of vec_rotate.
This makes things easy.
You simply have to use vec_rotate on both vectors before calling draw_box3d.

By the way, thanks for advising me of vec_rotate MokyjeBrute.

greetings
KDuke

Last edited by KDuke; 03/11/09 19:47.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Highlighting bounding box [Re: KDuke] #255673
03/11/09 20:19
03/11/09 20:19
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Wow, thank you, guys, for answers

I dont understand, why i need to rotate bb(bounding box).
I have an entity, then i rotate it and set new BB. So, logically, its looking like minimum and maximum points of BB may also be rotated(like on debug view)... i thought that blue box(box from debug panel) and my red box are build on the same points, max_x and min_x


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Highlighting bounding box [Re: VeT] #255680
03/11/09 20:44
03/11/09 20:44
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
Okay, then i'd reformulate question smile

I need to highlight entity (field) that is edited. Ambient dont give results that i want, so second idea was to highlight BB. Is it third simple idea? smile
Really, i just want to make highlighting simple as possible.


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Re: Highlighting bounding box [Re: VeT] #255684
03/11/09 20:50
03/11/09 20:50
Joined: Mar 2009
Posts: 40
MokyjeBrute Offline
Newbie
MokyjeBrute  Offline
Newbie

Joined: Mar 2009
Posts: 40
Why do not you use a lighter texture?

Re: Highlighting bounding box [Re: MokyjeBrute] #255691
03/11/09 21:45
03/11/09 21:45
Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
VeT Offline OP

Serious User
VeT  Offline OP

Serious User

Joined: Aug 2004
Posts: 1,345
Kyiv, Ukraine
lets say, thats not what i'm looking for.. border is quite good... i think about toon shader, but its seems to be too complicated


1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy

Newton2 videos: http://tinyurl.com/NewtonVideos
LiteC+Newton2 discussion: http://tinyurl.com/NewtonWrapperDiscussion
Latest LiteC+Newton2 version(v23, from 29.10.2009): http://depositfiles.com/files/ae1l0tpro
Page 1 of 2 1 2

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

Gamestudio download | 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