![]() |
Help Marquee tool - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Help Marquee tool (/thread-1223.html) Pages:
1
2
|
RE: Marquee tool - Richard - 11-06-2019 (11-06-2019, 09:04 AM)josemendez Wrote: Hi Richard,Hello. Is it possible to write code for a game? RE: Marquee tool - josemendez - 11-06-2019 (11-06-2019, 09:14 AM)Richard Wrote: Hello. If you are asking whether is it possible to create a marquee selection tool for a game, yes it is. But honestly, I'm still pretty unsure about what your goal is. RE: Marquee tool - Richard - 11-06-2019 (11-06-2019, 11:06 AM)josemendez Wrote: If you are asking whether is it possible to create a marquee selection tool for a game, yes it is. But honestly, I'm still pretty unsure about what your goal is. My goal is to make obi handle at runtime and change scale of cloth to fit to object. RE: Marquee tool - josemendez - 11-06-2019 (11-06-2019, 11:38 AM)Richard Wrote: My goal is to make obi handle at runtime and change scale of cloth to fit to object. You asked this before, and I answered with code to do it: http://obi.virtualmethodstudio.com/forum/showthread.php?tid=1197&highlight=handle My guess is that you want to let the user click and drag a rectangle on the screen to select multiple particles, then create a handle out of them. All of this, in your own application/game, not in the editor. So you're essentially making your own in-game particle editor. Is this correct? RE: Marquee tool - Richard - 11-06-2019 (11-06-2019, 12:02 PM)josemendez Wrote: You asked this before, and I answered with code to do it:No... Sorry for my English... I don't let user click and drag or any manipulate... Some clothing like uniform of speed skating, clothing has to be fit to object. Or other clothing like underwear of women need it . I would like to do that automatically. In the process, I want to choose particles by script, create obi handle and change scale. ObiSolver.position is below of ObiSolver.cs? Code: private void InitializeTransformFrame(){ I could not get variables like translation from there... In reference of ObiSolver, there is "AlignedVector4Array positions". There is not that in ObiSolver.cs now. I got position now. However, the position's type becomes float, not vector3... RE: Marquee tool - josemendez - 12-06-2019 (11-06-2019, 04:21 PM)Richard Wrote: No... In Obi 4.x, ObiSolver contains multiple per-particle data arrays: positions, velocities, invMasses, etc. The one you're interested in is "positions". Each position is a Vector4, with the w component set to 0. The InitializeTransformFrame method you posted above has nothing to do with particles or particle data. As the name implies, it initializes the solver's inertial transform frame. RE: Marquee tool - Richard - 12-06-2019 (12-06-2019, 07:13 AM)josemendez Wrote: In Obi 4.x, ObiSolver contains multiple per-particle data arrays: positions, velocities, invMasses, etc. The one you're interested in is "positions". Each position is a Vector4, with the w component set to 0. How can I get position? Or what is the best way to achieve what I want to do? I am thinking of AddParticle of ObiParticleHandle.cs RE: Marquee tool - josemendez - 12-06-2019 (12-06-2019, 11:10 AM)Richard Wrote: How can I get position? Or what is the best way to achieve what I want to do? solver.positions[solverIndex]; or actor.GetParticlePosition(actorIndex); See the docs: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html RE: Marquee tool - Richard - 12-06-2019 (12-06-2019, 12:23 PM)josemendez Wrote: solver.positions[solverIndex]; If I create editor, not in-game. How should I do? Like just put position and create handle... The position is up to the cloth.. What is the difference? And how should I change another script? There is "positions" in ObiSolver.cs, but how and where to change? Code: for (int i = 0; i < actor.positions.Length; ++i) Now, my code is Code: using System.Collections; I have an error now IndexOutOfRangeException: Index was outside the bounds of the array. Obi.CreateHandle.UpdateParticleEditorInformation () (at Assets/CreateHandle.cs:102) Obi.CreateHandle.Awake () (at Assets/CreateHandle.cs:25) I got another error: transform.position assign attempt for 'Obi Handle' is not valid. Input position is { NaN, NaN, NaN }. UnityEngine.Transform;set_position(Vector3) Obi.CreateHandle:Start() (at Assets/CreateHandle.cs:78) After that, error erased and result of GetParticlePosition became (0,0,0,0) a lot. I noticed that I failed to get component of actor.. My try of solver.position is Code: void Start() Most of the log is (0,0,0,0)... and a lot of results are like (0.0, 0.2, -0.3)... I tried renderablePositions, all of the result are (0,0,0,0)... |