CollisionBounds fourth value?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 617
Joined: Fri Sep 28, 2012 10:05 am
Contact:

CollisionBounds fourth value?

Post by Ats »

Hello. There is a fourth value that can be set for CollisionBounds, besides X,Y and Z.

collisionbounds.png
collisionbounds.png (14.33 KiB) Viewed 22073 times

There is no word about it in the Help:
The size of this model when it is tested for collision. This value is interpreted differently depending on the value of the CollisionStyle property:
• CollisionStyle is Rect2D or Rect2D_OBB: The first value represents the width, and the second value is the height.
• CollisionStyle is Sphere3D or Circle2D: The first value is the radius of the sphere.
• CollisionStyle is Box3D: The first value represents the width, the second is height, and the third value is the depth (x,y,z).
So what is it, and how to set/get it by code?
User avatar
Ats
Posts: 617
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: CollisionBounds fourth value?

Post by Ats »

Never mind, I got it like a color: Model.CollisionBounds.A

But now I'm wondering what it has to do with bounds :lol:

Edit:
and Model.CollisionBounds.W

Maybe it should be mentioned in the Help :wink:
Last edited by Ats on Mon Sep 11, 2023 8:21 pm, edited 1 time in total.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Re: CollisionBounds fourth value?

Post by Kjell »

Hi Ats,
Ats wrote: Mon Sep 11, 2023 7:47 pmThere is a fourth value that can be set for CollisionBounds, besides X,Y and Z. So what is it?
It's ( currently ) not used by any of the collision styles.
Ats wrote: Mon Sep 11, 2023 7:47 pmHow to set/get it by code?
Both XYZW and RGBA can be used with any 4D vector. So in order to access the 4th component of CollisionBounds you can use either W or A.

Which also means you can do this ( although i wouldn't recommend it ) :wink:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnUpdate>
    <ZExpression>
      <Expression>
<![CDATA[// Animate blue component of clear color

App.ClearColor.Z = cos(App.Time)*0.5+0.5;

// Animate x-coordinate of camera

App.CameraPosition.R = sin(App.Time);]]>
      </Expression>
    </ZExpression>
  </OnUpdate>
  <OnRender>
    <RenderSprite/>
  </OnRender>
</ZApplication>
In GLSL you can also use STPQ ( which is generally used when dealing with texture coordinates ), but that's not available elsewhere in ZGE.

K
User avatar
Ats
Posts: 617
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: CollisionBounds fourth value?

Post by Ats »

Hahaha, nice little hack Kjell :D
Post Reply