Author Topic: Box sides action  (Read 540 times)

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Box sides action
« on: February 05, 2019, 12:13:35 am »
Good day any idea on how to give an action of the sides of a box. By clicking or dragging the sides.
Like for example i drag the top sides. going up. it scale the box vertically.

Thanks :) :) :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #1 on: February 05, 2019, 07:59:45 am »
You can implement picking like so: http://www.jpct.net/wiki/index.php?title=Picking

In addition (to get the polygon that's affected by picking), you have to add a CollisionListener implementation of your own to the picked object, that returns true on requiresPolygonIDs. You can then ask the collision event for the polygon's id and armed with that, you can "guess" which side has been picked. The mapping between ID and your side has to be done by youself, but it in case of a cube, it shouldn't be too hard to figure it out.
« Last Edit: February 07, 2019, 06:02:53 pm by EgonOlsen »

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #2 on: February 06, 2019, 11:56:24 am »
Thank you for that but when i try the codes it doesn't pick the faces/sides of a box.
What i want to do if to make every action of the sides of my box.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #3 on: February 07, 2019, 06:04:21 pm »
Yes, I got that. And picking is the way to do just that. Actually, the wiki page contains everything that you have to know to get at least the picking itself working. What exactly does "it doesn't pick" mean in this context? Have you checked that your picking coordinates correct?

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #4 on: February 09, 2019, 08:59:11 am »
The codes is for desktop application my project is an android app.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #5 on: February 12, 2019, 08:54:28 am »
That actually doesn't matter. The picking works in exactly the same way (see private void relocate() in the example).

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #6 on: February 16, 2019, 09:30:23 am »
I do my best to understand the pick but it can't pick the sides base on the documentation. please help any more explanation for me to understand on how it going to detect those sides.

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #7 on: February 16, 2019, 11:44:49 am »
How can i set the sides of the box. By the way im using Extendedprimitive box. Like how can i identify if that sides of the box is picked.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #8 on: February 18, 2019, 08:29:38 am »
I'm not sure what you expect as a result? You'll get a polygon ID, a number. There's no general rule which number represents which polygon. It depends on the object and it might require a little bit or trial and error to find out.

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #9 on: February 22, 2019, 12:00:38 am »
I made the picking what i did is i make a box using Primitives plane. but my problem now is the rotation of my box when i rotate every single plane the box was destroyed

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #10 on: February 22, 2019, 08:55:27 am »
Just create a dummy Object3D (http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html#createDummyObj()), place it in the center of your box and assign it as parent object to your planes. Then rotate that object instead of the other individual planes.

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #11 on: February 24, 2019, 03:56:07 am »
Thanks for that its working another problem if how to get the dimension of my box

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #12 on: February 25, 2019, 11:16:51 am »
In which space? Object space or world space (i.e. before or after rotations have been applied)?

Offline itsmeveno

  • byte
  • *
  • Posts: 14
    • View Profile
Re: Box sides action
« Reply #13 on: March 03, 2019, 12:27:40 pm »
World space

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11963
    • View Profile
    • http://www.jpct.net
Re: Box sides action
« Reply #14 on: March 04, 2019, 12:44:40 pm »