How do I rearrange the execution order of solvers in Mixed Reality Toolkit? - unity3d

MRTK's Solver documentation says that you can "stack" solvers on the same object and their effects become cumulative.
The Known Issues section implies that you can control which order the solvers are evaluated in, and that this can cause differences in behavior.
How do I change the evaluation order for two solvers on the same GameObject?

They update in the order they appear on the game object in the inspector, top to bottom (as long as GetComponents continues to return them in that order!) You can rearrange component order by clicking the gear icon for a component in the inspector, and choosing 'Move Up' or 'Move Down'. Hope this helps!

Related

Hololens Spatial Mapping Collision - Mixed Reality Toolkit

I want to put a hologram-poster in AR, on the Hololens 1, on a wall using the Mixed Reality Toolkit. But everytime I try to put a hologram onto the spatial mapping it slides right through it and vanishes behind the spatial mapping.
What did I miss?
My understanding is you are implementing tap-to-place that enables users to move objects and place them on real-world surfaces. And your issue is that when you placing the object, it did not place on the surface as expected.
Usually, in MRTKv2, the Solver would be a good direction to implement tap-to-place.
The SurfaceMagnetism Solver can cast rays to surfaces in the world, and align the object to that surface.
So, you can add SurfaceMagnetism Component to the object and create a script that has two methods, one that turns on the solver when the object is selected and one that turns off the solver while the object is deselected. When you close the solver, the object will stay in the last position.

How can I change hand-rays in my MRTK v2 project for HoloLens 2 to parabolic instead of linear?

My HoloLens 2 project has content that is arranged as such I cannot target colliders with the existing hand-rays. I used to target my content with the head-gaze, but with hand-rays being lower on the body it is more difficult to reach the content that I want to select. I believe I would benefit from a parabolic selection ray, similar to those used when teleporting in Mixed Reality to reach surfaces above the participant.
The primary method of interacting with my content would be via a parabolic ray. There are instances within my application where I might change modality to focus on a menu system from close or far, and when I am far I'd like to change to a linear ray. So, having this capability to change the type of ray exposed via code would be preferred.
My project is employing the MRTK v2, and the standard linear hand-rays are functioning.
I would like to be able to change the type of ray being used in the Unity inspector, and to be able to change the style via code during run-time. I'd like to have control over the arc of the ray, as the scale of my content may impact the need for a different arc and min/max distance.
You can modify the DefaultControllerPointer prefab to use a Physical Parabolic Line Data Provider instead of a Bezier Line Data provider. This will distort the line used by the pointer to be more parabolic.
Before:
After:
Note that I removed the pink components and added the green components.
You will also want to increase the line cast resolution of the pointer from 2 to something larger, this means that the ray used to query what you have hit will have higher resolution:
And you may want to increase the resolution of the MR Line Renderer itself.
Demo of parabolic hand pointer:

How to transfer water from cylinder to tank in Dymola?

I've created a Dymola model. It has an empty tank, which is connected to the output of sweptVolume component via a static pipe. Input to the sweptVolume is a constant force, with the help of which I would like to transport water from the hydraulic cylinder to the tank.
I've assumed the cross sectional area of the piston. I've calculated the force that is needed to displace the water in the cylinder assuming the pressure to be atmospheric (101.325kPa). But, somehow I see the water is not getting displaced and the volume is remaining constant without filling the tank.
Please suggest, what type of input should be given for the sweptVolume element (position,move etc.), in case the given input constant force is wrong.
I would like to thank you for your time and interest.
the way to setup initial conditions it is only a matter of GUI, just add "flange(s(start=1, fixed=true))" in add modifiers tab of the sweptVolume parameter dialog in Dymola. To get your model work just invert the sign of the force, the sign convention for the force block is displayed by the arrow, so to compress the piston and fill the tank have to set the const value to minus something. Check the fluid volumes since you will get the model to stop when tank overflows or when piston stroke reaches the end (negative value of s). So you have to setup correctly the forces, or the tank and piston volumes or place some kind of stop to the mechanic part of the piston. The model can work fine even without masses added to the piston.
Hope this helps,
Marco

How to give Perspective access without Cube access?

in a Cube, I have a calculated measure [Nb>4] depending on a measure [Nb], filtering only the values above 4.
We don't want users to see the underlying measure [Nb], so I defined a perspective which hides it using -[Measures].[Nb]
I am looking for a way to give access to a perspective without giving access to the cube it depends on... (because using xmla (Excel), users can currently see the perspective and the cube).
I tried to do that using the roles definition module, but it seems not to be possible.
You can define the 'default' perspective (see first image). This perspective is a special one that applies visibility to all cube.
It should be possible then to hide your measure
-[Measures].[Nb]

Simulating physics for voxel constructions (Minecraft, Dwarf Fortress, etc)?

I'm hoping to prototype some very basic physics/statics simulations for "voxel-based" games like Minecraft and Dwarf Fortress, so that the game can detect when a player has constructed a structure that should not be able to stand up on its own.. Obviously this is a very fuzzy definition -- whether a structure is impossible depends upon multitude of material and environmental properties -- but the general idea is to motivate players to build structures that resemble the buildings we see in the real world. I'll describe what I mean in a bit more detail below, but I generally want to know if anyone could suggest either an potential approach to the problem or a resource that I could use.
Here's some examples of buildings that could be impossible if the material was not strong enough.
Here's some example situations. My understanding of this subject is not great but bear with me.
If this structure were to be made of concrete with dimensions of, say, 4m by 200m, it would probably not be able to stand up. Because the center of mass is not over its connection to the ground, I think it would either tip over or crack at the base.
The center of gravity of this arch lies between the columns holding it up, but if it was very big and made of a weak, heavy material, it would crumble under its own weight.
This tower has its center of gravity right over its base, but if it is sufficiently tall then it only takes a bit of force for the wind to topple it over.
Now, I expect that a full-scale real-time simulation of these physics isn't really possible... but there's a lot of ways that I could simplify the simulation. For example:
Tests for physics-defying structures could be infrequently and randomly performed, so a bad building doesn't crumble right as soon as it is built, but as much as a few minutes later.
Minecraft and Dwarf Fortress hardly perform rigid- or soft-body physics. For this reason, any piece of a building that is deemed to be physically impossible can simple "pop" into rubble instead of spawning a bunch of accurate physics props.
Have you considered taking an existing 3d environment physics engine and "rounding off" orientations of objects? In the case of your first object (the L-shaped thing), you could run a simulation of a continuous, non-voxelized object of similar shape behind the scenes and then monitor that object for orientation changes. In a simple case, if the object's representation of the continuous hits the ground, the object in the voxelized gameplay world could move its blocks to the ground.
I don't think there is a feasible way to do this. Minecraft has no notion of physical structure. So you will have to look at each block individually to determine if it should fall (there are other considerations but this is minimum). You would therefore need a way to distinguish between ground and "not ground". This is modeling problem first and foremost, not a programming problem (not even simulation design). I think this question is out of scope for SO.
For instance consider the following model, that may give you an indication of the complexities involved:
each block above height = 0 experiences a "down pull" = P, P may be any of the following:
0 if the box is supported by another box
m*g (where m is its mass which depends on material density * voxel volume) otherwise if it is free
F represents some "friction" or "glue" between vertical faces of boxes, it counteracts P.
This friction should have a threshold beyond which it "breaks" and the block then has a net pull downwards.
if m*g < sum F, box stays where it is. Otherwise, box falls.
F depends on the pairs of materials in contact
for n=2, so you can form a line of blocks between two towers
F is what causes the net pull of a box to be larger than m*g. For instance if you have two blocks a-b-c with c being on d, then a pulls on b, so b should be "heavier" than m*g where it contacts c. If this net is > F, then the pair a-b should fall.
You might be able to simulate the above and get interesting results, but you will find it really challenging to handle the case where there are two towsers with a line of blocks between them: the towers are coupled together by line of blocks, there is no longer a "tip" to the line of blocks. At this stage you might as well get out your physics books to create a system of boxes and springs and come up with equations that you might be able to solve numerically, but in a full 3D system you will have a 3D mesh of springs to navigate iteratively to converge to force values on each box and determine which ones move.
A professor of mine suggested that I look at this paper.
Additionally, I found the keyword for what it is I'm looking for. "Structural Analysis." I bought a textbook and I have a long road ahead of me.