I have figured out a nodal way of limiting a Matrix value in a child, which is handy.
Now I just need a way to reset a said Objects Matrix, say back to XYZ 0,0,0. How do I do that?
How to create a Push button to set Matrix value? - Jscript
- Draise
- Captain
- Posts: 3198
- Joined: 21 Sep 2009, 19:33
- Type the number ten into the box: 0
- Location: Bogota, Colombia
- Contact:
Re: How to create a Push button to set Matrix value? - Jscript
Code: Select all
// Called to execute the command
function Execute(params)
{
scene = Space.CurrentScene();
theTarget = Node.Select(scene + '/Cube');
targetWldMatrix = System.CreateDO("Math Package/Matrix Float Data");
targetObjMatrix = System.CreateDO("Math Package/Matrix Float Data");
//nodeMatrix = System.CreateDO("Math Package/Matrix Float Data");
targetWldMatrix = Node.Value(scene + '/Cube',"WldMatrix");
targetObjMatrix = Node.Value(scene + '/Cube',"ObjMatrix");
nodeMatrix = targetObjMatrix
nodeMatrix.SetTransX(3.500);
nodeMatrix.SetTransY(0.000);
nodeMatrix.SetTransZ(9.000);
System.Alert("Something should have happened.");
}
How do I get matrix values then have a way to set them?
Re: How to create a Push button to set Matrix value? - Jscript
you must put the value back into a matrix con
Node.Value(scene + '/Cube',"WldMatrix") = nodeMatrix;
Node.Value(scene + '/Cube',"WldMatrix") = nodeMatrix;
- Draise
- Captain
- Posts: 3198
- Joined: 21 Sep 2009, 19:33
- Type the number ten into the box: 0
- Location: Bogota, Colombia
- Contact:
Re: How to create a Push button to set Matrix value? - Jscript
I gave it a whirl, didn't quite manage personally. No errors, just.. not much happening. I probably need to study more javascript....
Re: How to create a Push button to set Matrix value? - Jscript
Code: Select all
function Execute(params)
{
scene = Space.CurrentScene();
theTarget = Node.Select(scene + '/Cube');
targetWldMatrix = System.CreateDO("Math Package/Matrix Float Data");
targetObjMatrix = System.CreateDO("Math Package/Matrix Float Data");
//nodeMatrix = System.CreateDO("Math Package/Matrix Float Data");
targetWldMatrix = Node.Value(scene + '/Cube',"WldMatrix");
targetObjMatrix = Node.Value(scene + '/Cube',"ObjMatrix");
nodeMatrix = targetObjMatrix
nodeMatrix.SetTransX(3.500);
nodeMatrix.SetTransY(0.000);
nodeMatrix.SetTransZ(9.000);
System.Alert("Something does have happened.");
Node.Value(scene + '/Cube',"Matrix") = nodeMatrix;
}
I forgot to put it on the 'in' matrix con or ownermatrix for the movement to register.
- Draise
- Captain
- Posts: 3198
- Joined: 21 Sep 2009, 19:33
- Type the number ten into the box: 0
- Location: Bogota, Colombia
- Contact:
Re: How to create a Push button to set Matrix value? - Jscript
Nice, I added a semicolon somewhere, that works! Handy! Thanks Stan. This will come in handy later.