Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  create Obi handle on script at runtime
#8
(24-05-2019, 10:46 AM)Richard Wrote: Sorry...  That's it. I want to create that. Can I choose particle on script by marquee tool?

Implementing a marquee selection tool has very little to do with Obi. It mainly involves Unity GUI/events, so it's unfortunately out of the scope of Obi support.

Once you have a screen-space marquee rectangle working (all the clicking/dragging logic in place, as well as UI drawing) you can simply iterate trough all particles getting their world space position and projecting it to screen space to see it they're within the marquee.

Code:
for (int i = 0; i < actor.particleIndices.Length; ++i){
Vector3 wsPos = actor.GetParticlePosition(i);

//TODO: convert wsPos to screen space, and check if the coordinates are within the marquee.
}

I'd suggest taking a look at some Unity GUI tutorials, or browse the Unity forums for ready-made stuff:
https://forum.unity.com/threads/rts-styl...ox.265739/
https://www.habrador.com/tutorials/selec...rectangle/


Messages In This Thread
RE: create Obi handle on script at runtime - by josemendez - 24-05-2019, 02:27 PM