Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
195 stars 9 forks source link

[Feature Request] Transform interaction component for clamping Scale #506

Open Abysmal2134 opened 4 years ago

Abysmal2134 commented 4 years ago

I would like to request a transform component for interacting with an object or collider's Scale.

Similarly to how the Slider and Joint components in Transform/Interactions work for position and rotation, this Scaler component would limit the minimum and maximum values an object can be scaled on each XYZ axis and similar to snap Position/Orientations for the other components there can be snap scales for each XYZ value or scale steps to increment values.

So for example we have a cube with XYZ dimensions (1;1;1) that would be the default minimum ones and a range for each XYZ axis that limits how much you can scale the object on each of them.

Having this component would allow people to drive blendshapes by grabbing onto invisible objects/colliders, without having to fear that the volume of the object/collider would exceed the bounds of the blendshapes it's driving. It would allow to simulate things like grabbing an invisible collider to set the jaws of a of a trap or animal opened/closed, or open the mouth of a pouch, and have the bounds of the collider correspond to where the blendshape's boundaries are (if you use something like a torus).

Sorry if there's already a way to drive an object's scale this way, but I couldn't find any component that lets you set such limits to scale and making something for this in Logix would be beyond me and just way too limiting if you want to use scale as a way to drive objects's blendshapes if you have to implement a different setup multiple times.

TehTurk commented 4 years ago

Hmm, so something name wise like a Sizer? But even then for stuff like Blendshapes and the like they operate on the scale of 0-1 so they might not translate too well. I think currently you could try tossing in the Scale to a slider's pos drive target and it should have a similar effect. Long as it's a float3 it should work.

Frooxius commented 4 years ago

Hello. I'm not fully sure I understand what exactly would the component do. Are you looking for something that just clamps the scale that's changed by external means?

Or something that you can grab and simply by grabbing it at one point it will drive the objects scale as you move the grabbed point around (this would be similar to what the Joint/Slider do).

I do not quite understand the relation to driving the blendshapes. Why would you have to fear that volume of object/collider would exceed bounds of the blendshapes it's driving? Blendshapes don't have concept of "bounds", unless you mean the extents of the mesh of the fully deformed form? But even with that I'm not quite sure how it relates.

Abysmal2134 commented 4 years ago

I had in mind a component that just clamps the scale by external means. You grab with both hands (physical only or with lasers) to scale an object like you would normally do, but the minimum and maximum scale for each axis can be limited by the component, or you could make the scaling snap by increments.

But now that I think about it, an option toggle for being able to grab an object with one hand and driving its scale by moving it closer or further away from its origin, could also have some potentially good applications. For example adjusting the height of walls from the ground by simply grabbing it and scaling it up along the Y axis, or quickly adjusting block points in a maze with X and Z axis scaling.

The main reason I brought up the the object/collider volume exceeding the visual bounds for a blendshape is that, when you have the ability to scale that object/collider infinitely in size it would not only exceed the visual deformation of the mesh, making it harder to coincide the volume they take, but you would have the problem of an invisible collider that is scaled too much out of bounds, that would get in the way of resetting the blendshapes value back to normal while scaling it down, not to mention the problems of an invisible collider blocking raycasts or being grabbed and scaled by others. Scaling it down too much poses a problem too.

Lets say the use case for clamps on a scalable collider is driving the blendhape for opening and closing an I ordinary sack. I would want the radius of the collider to match the edges of the sack's opening. So I have a torus collider that has a minimum scale on X and Z axes of 10 cm each and a max of 40 cm, with Y axis fixed at 10 cm to represent the actual hole's dimensions. I can then match those values to a drive a blendshape from 0 to 1.

With scale limits I wouldn't have to worry about scaling the collider to 10 meters on all axes and making it hard to scale it down and close back the sack, and getting in the way of other people too.

Edit: Another example would be something like Goku's Power Pole, a staff that you can extend by scaling on the Y axis. You'd need to have reasonable limits set. You could actually use this scaling principle for driving visemes for something like RWBY's Crescent Rose, where the scythe weapon is extended/transformed between blendshapes for different weapon modes, by using scale increments to snap drive between modes with lerp or just smoothly scaling between transitions.

I hope I explained what I had in mind precisely enough.