Bug in smf_sample_get_bone_orientation:
Code:
var bindPose, modelIndex, bone, sample, R, S, Q, i;
sample = argument0;
bone = ds_list_find_value(modelIndex[| SMF_model.BindSampleMappingList], argument1);
modelIndex = sample[array_length_1d(sample) - 1];
Code:
var bindPose, modelIndex, bone, sample, R, S, Q, i;
sample = argument0;
modelIndex = sample[array_length_1d(sample) - 1];
bone = ds_list_find_value(modelIndex[| SMF_model.BindSampleMappingList], argument1);
modelIndex need to be one row up. Else modelIndex will give an non existing variable error.
EDIT:
Seems to be a bug when you get a linear sample too: (Or maybe it's just me being dumb again)
When I use this:
Code:
var default_sample=smf_sample_create(model_3d_link_library_my_parent.model_3d_model,0,SMF_play_linear,0);
I will get an array with:
{ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16 }, }
This has a lot of zero data and cant be used with smf_sample_get_bone_orientation(default_sample,1). It just give me wrong orientation.
Code:
var default_pose=smf_pose_create(model_3d_link_library_my_parent.model_3d_model,0,SMF_play_linear,0);
default_sample=smf_sample_create_from_pose(default_pose);
I get:
{ { 0,0,0,1,0,0,0,0,0,16 }, }
And when used in smf_sample_get_bone_orientation(default_sample,1) I get the correct orientation that I can use to create a matrix with smf_matrix_create_from_dualquat.
EDIT 2:
Created code to link models with each other:
The wheel is animated and is linked to the cars matrix. So if you move the car the wheel follow as it should. Another wheel is linked to the first wheel with a bone index so it follow the turn animation. A third wheel is linked to the second wheel bone and follow that wheel when it moves and animates.
All done with some calls:
Code:
// Get wheel position in car space
var position=smf_node_get_position(model_, node_index);
// Create model in car space
var test_model=scr_3D_model_create(position[0],position[1],position[2],"FrontWheel");
// Set scale to invert wheel
test_model.child_xs=-1;
test_model.child_ys=1;
test_model.child_zs=-1;
// Link this model to the car space (child values is offset from car origin)
scr_3D_model_link_model(id,test_model,noone);
// Start animation on wheel
scr_3D_model_animation_set(test_model,"Turn",1000);
// Test link in link
// Create model in first wheel bone space
var test_model2=scr_3D_model_create(1,0,0,"FrontWheel");
// Set scale to invert wheel
test_model2.child_xs=-1;
test_model2.child_ys=-1;
test_model2.child_zs=1;
// Link this wheel to the first wheel on bone 1
scr_3D_model_link_model(test_model,test_model2,1);
// Start animation on this wheel too
scr_3D_model_animation_set(test_model2,"Turn",2000);
// Test link in link in link
// Create wheel in second wheel bone space
var test_model3=scr_3D_model_create(1,0,0,"FrontWheel");
// Set scale to invert wheel
test_model3.child_xs=-1;
test_model3.child_ys=-1;
test_model3.child_zs=1;
// Link this wheel to wheel 2
scr_3D_model_link_model(test_model2,test_model3,1);
This could be used to run separate animations on each part of a character. Or add a shield that follow your characters hand. And you don't need to worry that the animation sample would separate ex an arm from the body. Because each child matrix is in the parent space. And if a child got children, the children is in the child-parent space, and so on.
EDIT 3:
Wish 5372:
LOD handler so we can import 2 or more models with different LOD levels and setup when each model should be used depending on the distance from the camera. This could be manually done, but it would be great if it was integrated into the engine itself.
EDIT 4:
Wish 5373:
When using normal maps its good practice to be able to set the depth value. When you are close to a model you want a low depth on the normal map so the model look more smooth but with good details. When far away you want a higher value so you can compensate the else blury surface.
EDIT 5:
In the model tool. When assign a model to a node. The node is hidden in the model so it's hard to move it. Tips is to make the model somewhat transparent or draw the node after model without depth.