About Store Forum Documentation Contact



Post Reply 
Drawing 2d image for actor
Author Message
ronghester Offline
Member

Post: #1
Drawing 2d image for actor
I have a actor created from box. It is just a box which gets rotated and translated during the game. I am able to rotate or translate the box by setting actor matrix.

I want to draw a 2d image representing this actor. I tried following

1. get the box of actor and construct a 2d rect using min/max. (Does not work as the box is global bounding box)

2. Save the Box from which the actor is getting created and then create OBox using actor matrix and box. (does not work)

I wonder how the actor.draw function works ? Is there any way to achieve this.

Thanks
03-06-2019 08:05 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #2
RE: Drawing 2d image for actor
Okay simple, how can i draw just a rectangle using the actor box ? I am trying to develop something like this in esenthel.
https://medium.com/@hyperparticle/draw-2...0ec634381c

instead of rectangle, i am drawing the boxes using actor and orientating them based on the user input, now the problem is representing those boxes nicely using the outlined rectangles, which is where i am stuck.

Any help would be appreciated.
03-08-2019 07:48 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Drawing 2d image for actor
Hi,

A rectangle is composed from 4 lines, so you can do:
VI.color(..);
VI.line(..);
..
VI.end();
03-09-2019 04:17 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #4
RE: Drawing 2d image for actor
Yes but how to get the four points of the box represented by the actor? I have a actor created with box and want to draw a rectangle for the user facing plane of the box?
03-09-2019 07:10 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Drawing 2d image for actor
I think Actor.shape is ok for your needs
03-09-2019 07:17 AM
Find all posts by this user Quote this message in a reply
ronghester Offline
Member

Post: #6
RE: Drawing 2d image for actor
Thanks, yes Actor.shape has worked i am able to get the box and then draw a rectangle looking shape using that box.

Another problem, i want to draw a border around the box (This box has no dept as i want to represent this as a rectangle).

I have created a bigger box and then use that as a border,which has actually worked but there flickering as both boxes are drawn at same position. I am not able to set the z position of the second box (which is used as a border) I tried following

1. Once the first box is drawn, set matrix with -Z value. (did not work) the boxes actually getting drawn at different positions now
2. set the actual position of the second to -Z (did not work) same as above.

What would be possible solution here ??

I don't have meshes so can't use the drawOutline method. Rect won't work as they don't respect the matrix.
03-09-2019 07:46 PM
Find all posts by this user Quote this message in a reply
Post Reply