File size: 2,219 Bytes
09a6f7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
let CustomUserDataObjectTypes = {
BODY_OBJECT: 0,
WATER: 1,
TERRAIN: 2,
GRIP_TERRAIN: 3,
MOTOR: 4,
BODY_SENSOR: 5,
SENSOR_GRIP_TERRAIN:6,
};
/**
* @classdesc Class used to store data about different objects.
*/
class CustomUserData{
/**
* @constructor
* @param name {string}
* @param object_type {number}
*/
constructor(name, object_type){
this.name = name;
this.object_type = object_type;
}
}
/**
* @classdesc Motor user data class.
*/
class CustomMotorUserData extends CustomUserData{
/**
* @constructor
* @param name {string}
* @param speed_control {number}
* @param check_contact {boolean}
* @param angle_correction {number}
* @param contact_body {Object}
*/
constructor(name, speed_control, check_contact, angle_correction=0.0, contact_body=null){
super(name, CustomUserDataObjectTypes.MOTOR);
this.speed_control = speed_control;
this.check_contact = check_contact;
this.angle_correction = angle_correction;
this.contact_body = contact_body;
}
}
/**
* @classdesc Body user data class.
*/
class CustomBodyUserData extends CustomUserData{
/**
* @constructor
* @param check_contact {boolean}
* @param is_contact_critical {boolean}
* @param name {string}
* @param object_type {number}
*/
constructor(check_contact, is_contact_critical=false,
name="body_part", object_type=CustomUserDataObjectTypes.BODY_OBJECT){
super(name, object_type);
this.check_contact = check_contact;
this.is_contact_critical = is_contact_critical;
this.has_contact = false;
}
}
/**
* @classdesc Sensor user data class.
*/
class CustomBodySensorUserData extends CustomBodyUserData{
/**
* @constructor
* @param check_contact {boolean}
* @param is_contact_critical {boolean}
* @param name {string}
*/
constructor(check_contact, is_contact_critical=false, name="body_part"){
super(check_contact, is_contact_critical, name, CustomUserDataObjectTypes.BODY_SENSOR);
this.has_joint = false;
this.ready_to_attach = false;
}
}
|