Thanks for the code, the part where you create the limbs completely messed up the object for me, so I never used that part.
Here is a solution:
sync on
autocam off
position camera 60,80,-100
point camera 0,0,0
ridutt_scale# = 1.5
durata_intervalli# = 100 rem WAIT PAUSE FOR THE STEPS
rem ******************************** MAIN OBJECT 1 BODY
rem corpo aereo
rem corpo aereo
MAKE OBJECT CYLINDER 8999, 28
scale object 8999,80/ridutt_scale#,280/ridutt_scale#,80/ridutt_scale#
color object 8999,rgb(200,200,200)
rem position object 8999, 8, 40, -28.99
rem position object 8999, 0, 0, 0
rotate object 8999,90,0,0
set object cull 8999,0
time=timer()
repeat
text 20,20,"1) MAIN OBJECT 8999 -BODY-"
sync
until timer()-time>=durata_intervalli#
rem ************************** OBJECT 9000 LEFT WING.
rem ala sinistra
load object "ala_aereo_scaled.x",9000
scale object 9000,3/ridutt_scale#,2/ridutt_scale#,3/ridutt_scale#
color object 9000,rgb(200,200,200)
position object 9000, -43.79, 4.12, -14.96
time=timer()
repeat
text 20,20,"2) OBJECT 9000 LEFT WING. (will be MESH1 for LIMB1)"
sync
until timer()-time>=durata_intervalli#
rem ************************** OBJECT 9001 RIGHT WING.
rem ala sinistra
load object "ala_aereo_scaled.x",9001
scale object 9001,3/ridutt_scale#,2/ridutt_scale#,3/ridutt_scale#
rotate object 9001,0,0,-180
color object 9001,rgb(200,200,200)
position object 9001, 43.94, 6.38, -14.69
time=timer()
repeat
text 20,20,"3) OBJECT 9001 RIGHT WING. (will be MESH2 for LIMB2)"
sync
until timer()-time>=durata_intervalli#
// rem ************************** OBJECT 9002 ATTACH FOR WINGS
// rem ATTACH FOR WINGS
// make object box 9002, 11,2.5,34
// rotate object 9002,0,0,0
// color object 9002,rgb(200,200,200)
// position object 9002, 0.02, 5.65, -3.34
// time=timer()
// repeat
// text 20,20,"4) OBJECT 9002 ATTACH FOR WINGS. (will MESH3 for LIMB3)"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** Creo OBJECT 9003 tail cone
// rem tail cone
// MAKE OBJECT CONE 9003, 28
// scale object 9003,80/ridutt_scale#,260/ridutt_scale#,80/ridutt_scale#
// color object 9003,rgb(200,200,200)
// position object 9003, 0, 3.60, -49
// rotate object 9003,-82,0,0
// time=timer()
// repeat
// text 20,20,"5) OBJECT 9003 TAIL CONE. (will MESH4 for LIMB4)"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** Creo rudder tail
// rem rudder tail
// load object "ala_aereo_scaled.x",9004
// scale object 9004,1.0/ridutt_scale#,2/ridutt_scale#,2.5/ridutt_scale#
// color object 9004,rgb(200,200,200)
// position object 9004, -1.01, 19.45, -61.29
// rotate object 9004,0,0,-90
// time=timer()
// repeat
// text 20,20,"6) OBJECT 9004 RUDDER TAIL. (will MESH5 per il LIMB5)"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 1 LEFT WING
// make mesh from object 1,9000 rem left wing
// add limb 8999,1,1
// offset limb 8999,1,object position x(9000),object position y(9000),object position z(9000)
// rotate limb 8999,1,object angle x(9000),object angle y(9000),object angle z(9000)
// delete object 9000
// time=timer()
// repeat
// text 20,20,"7) MAKING LIMB 1 LEFT WING"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 2 RIGHT WING
// make mesh from object 2,9001 rem right wing
// add limb 8999,2,2
// offset limb 8999,2,object position x(9001),object position y(9001),object position z(9001)
// rotate limb 8999,2,object angle x(9001),object angle y(9001),object angle z(9001)
// delete object 9001
// time=timer()
// repeat
// text 20,20,"8) MAKING LIMB 2 RIGHT WING"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 3 ATTACH WINGS
// make mesh from object 3,9002 rem ala sin
// add limb 8999,3,3
// offset limb 8999,3,object position x(9002),object position y(9002),object position z(9002)
// rotate limb 8999,3,object angle x(9002),object angle y(9002),object angle z(9002)
// delete object 9002
// time=timer()
// repeat
// text 20,20,"9) MAKING LIMB 3 ATTACH WINGS"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** MAKING LIMB 4 TAIL CONE
// make mesh from object 4,9003 rem ala sin
// add limb 8999,4,4
// offset limb 8999,4,object position x(9003),object position y(9003),object position z(9003)
// rotate limb 8999,4,object angle x(9003),object angle y(9003),object angle z(9003)
// delete object 9003
// time=timer()
// repeat
// text 20,20,"10) MAKING LIMB 4 TAIL CONE"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** MAKING LIMB 5 RUDDER TAIL
// make mesh from object 5,9004 rem rudder tail
// add limb 8999,5,5
// offset limb 8999,5,object position x(9004),object position y(9004),object position z(9004)
// rotate limb 8999,5,object angle x(9004),object angle y(9004),object angle z(9004)
// delete object 9004
// time=timer()
// repeat
// text 20,20,"11) MAKING LIMB 4 TAIL CONE"
// sync
// until timer()-time>=durata_intervalli#
//
DYN START
DYN SET PARAMETER 9, 1
DYN SET PARAMETER 39, 1
DYN MAKE BOX 8999, 1.0
DYN COOK CONVEX MESH 9000, 1
DYN MAKE CONVEX MESH 9000, 1, 1.0
DYN COOK CONVEX MESH 9001, 2
DYN MAKE CONVEX MESH 9001, 2, 1.0
makeJointFixed(1, 9000, 8999)
makeJointFixed(2, 9001, 8999)
DYN SIMULATE
do
DYN FETCH RESULTS
DYN UPDATE
DYN DEBUG RENDER
DYN SIMULATE
cf# = 0
if mouseclick()=1 then cf#=1
if mouseclick()=2 then cf#=-1
// cx#=wrapvalue(cx#+mousemovey()*0.5)
// cy#=wrapvalue(cy#+mousemovex()*0.5)
// if cx#<=290 and cx#>180 then cx#=290
// if cx#>=70 and cx#<=180 then cx#=70
// acx#=curveangle(cx#,acx#,2.1)
// acy#=curveangle(cy#,acy#,2.1)
// rotate camera acx#,acy#,0
// acf#=curvevalue(cf#,acf#,20)
if upkey()
position camera camera position x(), camera position y() + 1, camera position z()
endif
if downkey()
position camera camera position x(), camera position y() - 1, camera position z()
endif
point camera 0, 0, 0
move camera cf#
// cf#=0
text 20,20,"YOU CAN MOVE CAMERA WITH MOUSE"
sync
loop
//-- Fixed jo fixes two actors together as though they are one actor, they will not move
//-- or rotate relative to each other.
function makeJointFixed(jointID, objectA, objectB)
//-- Create descriptor data structure.
DYN MAKE JOINT DESC 1
//-- Locked motion relative to joint position.
DYN JOINT DESC SET MOTION X 1, NX_D6JOINT_MOTION_LOCKED
DYN JOINT DESC SET MOTION Y 1, NX_D6JOINT_MOTION_LOCKED
DYN JOINT DESC SET MOTION Z 1, NX_D6JOINT_MOTION_LOCKED
//-- Locked rotation also.
DYN JOINT DESC SET SWING1 MOTION 1, 0
DYN JOINT DESC SET SWING2 MOTION 1, 0
DYN JOINT DESC SET TWIST MOTION 1, 0
//-- What actors are involved?
DYN JOINT DESC SET ACTOR A 1, objectA
DYN JOINT DESC SET ACTOR B 1, objectB
//-- Must set this after actors have been set.
//-- Location of anchor can be anything for a fixed joint.
DYN JOINT DESC SET GLOBAL ANCHOR 1, 0, 0, 0
DYN JOINT DESC SET GLOBAL AXIS 1, 0, 1, 0
//-- Create joint.
DYN MAKE JOINT jointID, 1
//-- No longer need descriptor.
DYN DELETE JOINT DESC 1
endfunction
It's not exactly what you asked for but it gives a perfect collision shape for your plane.
Advantages:
- No confusing limb code, just get your shapes looking like a plane and make convex meshes for everything and join them together with physics joints.
- Plane can fall apart if needed, just delete joints upon crash.
- Less code, not as complicated.
Disadvantages:
- May not be as efficient with joints as it would be with compound actor, I doubt it makes much difference.
I had issues with convex shape(compound) and that model, I will need to investigate further, but hopefully I have given you a better solution above.
EDIT: Modified code, code above needs PhysX constants file. Code below does not, also shows how to blow off a wing
sync on
autocam off
position camera 60,80,-100
point camera 0,0,0
ridutt_scale# = 1.5
durata_intervalli# = 100 rem WAIT PAUSE FOR THE STEPS
rem ******************************** MAIN OBJECT 1 BODY
rem corpo aereo
rem corpo aereo
MAKE OBJECT CYLINDER 8999, 28
scale object 8999,80/ridutt_scale#,280/ridutt_scale#,80/ridutt_scale#
color object 8999,rgb(200,200,200)
rem position object 8999, 8, 40, -28.99
rem position object 8999, 0, 0, 0
rotate object 8999,90,0,0
set object cull 8999,0
time=timer()
repeat
text 20,20,"1) MAIN OBJECT 8999 -BODY-"
sync
until timer()-time>=durata_intervalli#
rem ************************** OBJECT 9000 LEFT WING.
rem ala sinistra
load object "ala_aereo_scaled.x",9000
scale object 9000,3/ridutt_scale#,2/ridutt_scale#,3/ridutt_scale#
color object 9000,rgb(200,200,200)
position object 9000, -43.79, 4.12, -14.96
time=timer()
repeat
text 20,20,"2) OBJECT 9000 LEFT WING. (will be MESH1 for LIMB1)"
sync
until timer()-time>=durata_intervalli#
rem ************************** OBJECT 9001 RIGHT WING.
rem ala sinistra
load object "ala_aereo_scaled.x",9001
scale object 9001,3/ridutt_scale#,2/ridutt_scale#,3/ridutt_scale#
rotate object 9001,0,0,-180
color object 9001,rgb(200,200,200)
position object 9001, 43.94, 6.38, -14.69
time=timer()
repeat
text 20,20,"3) OBJECT 9001 RIGHT WING. (will be MESH2 for LIMB2)"
sync
until timer()-time>=durata_intervalli#
// rem ************************** OBJECT 9002 ATTACH FOR WINGS
// rem ATTACH FOR WINGS
// make object box 9002, 11,2.5,34
// rotate object 9002,0,0,0
// color object 9002,rgb(200,200,200)
// position object 9002, 0.02, 5.65, -3.34
// time=timer()
// repeat
// text 20,20,"4) OBJECT 9002 ATTACH FOR WINGS. (will MESH3 for LIMB3)"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** Creo OBJECT 9003 tail cone
// rem tail cone
// MAKE OBJECT CONE 9003, 28
// scale object 9003,80/ridutt_scale#,260/ridutt_scale#,80/ridutt_scale#
// color object 9003,rgb(200,200,200)
// position object 9003, 0, 3.60, -49
// rotate object 9003,-82,0,0
// time=timer()
// repeat
// text 20,20,"5) OBJECT 9003 TAIL CONE. (will MESH4 for LIMB4)"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** Creo rudder tail
// rem rudder tail
// load object "ala_aereo_scaled.x",9004
// scale object 9004,1.0/ridutt_scale#,2/ridutt_scale#,2.5/ridutt_scale#
// color object 9004,rgb(200,200,200)
// position object 9004, -1.01, 19.45, -61.29
// rotate object 9004,0,0,-90
// time=timer()
// repeat
// text 20,20,"6) OBJECT 9004 RUDDER TAIL. (will MESH5 per il LIMB5)"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 1 LEFT WING
// make mesh from object 1,9000 rem left wing
// add limb 8999,1,1
// offset limb 8999,1,object position x(9000),object position y(9000),object position z(9000)
// rotate limb 8999,1,object angle x(9000),object angle y(9000),object angle z(9000)
// delete object 9000
// time=timer()
// repeat
// text 20,20,"7) MAKING LIMB 1 LEFT WING"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 2 RIGHT WING
// make mesh from object 2,9001 rem right wing
// add limb 8999,2,2
// offset limb 8999,2,object position x(9001),object position y(9001),object position z(9001)
// rotate limb 8999,2,object angle x(9001),object angle y(9001),object angle z(9001)
// delete object 9001
// time=timer()
// repeat
// text 20,20,"8) MAKING LIMB 2 RIGHT WING"
// sync
// until timer()-time>=durata_intervalli#
//
// rem ************************** MAKING LIMB 3 ATTACH WINGS
// make mesh from object 3,9002 rem ala sin
// add limb 8999,3,3
// offset limb 8999,3,object position x(9002),object position y(9002),object position z(9002)
// rotate limb 8999,3,object angle x(9002),object angle y(9002),object angle z(9002)
// delete object 9002
// time=timer()
// repeat
// text 20,20,"9) MAKING LIMB 3 ATTACH WINGS"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** MAKING LIMB 4 TAIL CONE
// make mesh from object 4,9003 rem ala sin
// add limb 8999,4,4
// offset limb 8999,4,object position x(9003),object position y(9003),object position z(9003)
// rotate limb 8999,4,object angle x(9003),object angle y(9003),object angle z(9003)
// delete object 9003
// time=timer()
// repeat
// text 20,20,"10) MAKING LIMB 4 TAIL CONE"
// sync
// until timer()-time>=durata_intervalli#
//
//
// rem ************************** MAKING LIMB 5 RUDDER TAIL
// make mesh from object 5,9004 rem rudder tail
// add limb 8999,5,5
// offset limb 8999,5,object position x(9004),object position y(9004),object position z(9004)
// rotate limb 8999,5,object angle x(9004),object angle y(9004),object angle z(9004)
// delete object 9004
// time=timer()
// repeat
// text 20,20,"11) MAKING LIMB 4 TAIL CONE"
// sync
// until timer()-time>=durata_intervalli#
//
DYN START
DYN SET PARAMETER 9, 1
DYN SET PARAMETER 39, 1
DYN MAKE BOX 8999, 1.0
DYN COOK CONVEX MESH 9000, 1
DYN MAKE CONVEX MESH 9000, 1, 1.0
DYN COOK CONVEX MESH 9001, 2
DYN MAKE CONVEX MESH 9001, 2, 1.0
makeJointFixed(1, 8999, 9000)
makeJointFixed(2, 8999, 9001)
DYN SIMULATE
do
DYN FETCH RESULTS
DYN UPDATE
DYN DEBUG RENDER
DYN SIMULATE
cf# = 0
if mouseclick()=1 then cf#=1
if mouseclick()=2 then cf#=-1
// cx#=wrapvalue(cx#+mousemovey()*0.5)
// cy#=wrapvalue(cy#+mousemovex()*0.5)
// if cx#<=290 and cx#>180 then cx#=290
// if cx#>=70 and cx#<=180 then cx#=70
// acx#=curveangle(cx#,acx#,2.1)
// acy#=curveangle(cy#,acy#,2.1)
// rotate camera acx#,acy#,0
// acf#=curvevalue(cf#,acf#,20)
if upkey()
position camera camera position x(), camera position y() + 1, camera position z()
endif
if downkey()
position camera camera position x(), camera position y() - 1, camera position z()
endif
DYN ADD FORCE 8999, 0, 500, 0
if object position y(8999) > 100 and DYN JOINT EXISTS(1)
DYN DELETE JOINT 1
endif
point camera 0, 0, 0
move camera cf#
// cf#=0
text 20,20,"YOU CAN MOVE CAMERA WITH MOUSE"
sync
loop
//-- Fixed jo fixes two actors together as though they are one actor, they will not move
//-- or rotate relative to each other.
function makeJointFixed(jointID, objectA, objectB)
//-- Create descriptor data structure.
DYN MAKE JOINT DESC 1
//-- Locked motion relative to joint position.
DYN JOINT DESC SET MOTION X 1, 0
DYN JOINT DESC SET MOTION Y 1, 0
DYN JOINT DESC SET MOTION Z 1, 0
//-- Locked rotation also.
DYN JOINT DESC SET SWING1 MOTION 1, 0
DYN JOINT DESC SET SWING2 MOTION 1, 0
DYN JOINT DESC SET TWIST MOTION 1, 0
//-- What actors are involved?
DYN JOINT DESC SET ACTOR A 1, objectA
DYN JOINT DESC SET ACTOR B 1, objectB
//-- Must set this after actors have been set.
//-- Location of anchor can be anything for a fixed joint.
DYN JOINT DESC SET GLOBAL ANCHOR 1, 0, 0, 0
DYN JOINT DESC SET GLOBAL AXIS 1, 0, 1, 0
//-- Create joint.
DYN MAKE JOINT jointID, 1
//-- No longer need descriptor.
DYN DELETE JOINT DESC 1
endfunction