diff options
Diffstat (limited to 'tests/test_physics_3d.cpp')
-rw-r--r-- | tests/test_physics_3d.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/test_physics_3d.cpp b/tests/test_physics_3d.cpp index 727c44b3ac..02f1b8175d 100644 --- a/tests/test_physics_3d.cpp +++ b/tests/test_physics_3d.cpp @@ -70,14 +70,14 @@ class TestPhysics3DMainLoop : public MainLoop { void body_changed_transform(Object *p_state, RID p_visual_instance) { PhysicsDirectBodyState3D *state = (PhysicsDirectBodyState3D *)p_state; RenderingServer *vs = RenderingServer::get_singleton(); - Transform t = state->get_transform(); + Transform3D t = state->get_transform(); vs->instance_set_transform(p_visual_instance, t); } bool quit; protected: - RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform p_location, bool p_active_default = true, const Transform &p_shape_xform = Transform()) { + RID create_body(PhysicsServer3D::ShapeType p_shape, PhysicsServer3D::BodyMode p_body, const Transform3D p_location, bool p_active_default = true, const Transform3D &p_shape_xform = Transform3D()) { RenderingServer *vs = RenderingServer::get_singleton(); PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); @@ -179,7 +179,7 @@ protected: type_shape_map[PhysicsServer3D::SHAPE_CONVEX_POLYGON] = convex_shape; } - void make_trimesh(Vector<Vector3> p_faces, const Transform &p_xform = Transform()) { + void make_trimesh(Vector<Vector3> p_faces, const Transform3D &p_xform = Transform3D()) { RenderingServer *vs = RenderingServer::get_singleton(); PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); RID trimesh_shape = ps->shape_create(PhysicsServer3D::SHAPE_CONCAVE_POLYGON); @@ -209,12 +209,12 @@ protected: ps->body_set_space(tribody, space); //todo set space ps->body_add_shape(tribody, trimesh_shape); - Transform tritrans = p_xform; + Transform3D tritrans = p_xform; ps->body_set_state(tribody, PhysicsServer3D::BODY_STATE_TRANSFORM, tritrans); vs->instance_set_transform(triins, tritrans); } - void make_grid(int p_width, int p_height, real_t p_cellsize, real_t p_cellheight, const Transform &p_xform = Transform()) { + void make_grid(int p_width, int p_height, real_t p_cellsize, real_t p_cellheight, const Transform3D &p_xform = Transform3D()) { Vector<Vector<real_t>> grid; grid.resize(p_width); @@ -261,7 +261,7 @@ public: if (mover.is_valid()) { PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); - Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM); + Transform3D t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM); t.origin += Vector3(x, y, 0); ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t); @@ -287,7 +287,7 @@ public: scenario = vs->scenario_create(); vs->light_set_shadow(lightaux, true); light = vs->instance_create2(lightaux, scenario); - Transform t; + Transform3D t; t.rotate(Vector3(1.0, 0, 0), 0.6); vs->instance_set_transform(light, t); @@ -304,9 +304,9 @@ public: vs->viewport_set_scenario(viewport, scenario); vs->camera_set_perspective(camera, 60, 0.1, 40.0); - vs->camera_set_transform(camera, Transform(Basis(), Vector3(0, 9, 12))); + vs->camera_set_transform(camera, Transform3D(Basis(), Vector3(0, 9, 12))); - Transform gxf; + Transform3D gxf; gxf.basis.scale(Vector3(1.4, 0.4, 1.4)); gxf.origin = Vector3(-2, 1, -2); make_grid(5, 5, 2.5, 1, gxf); @@ -317,12 +317,12 @@ public: if (mover.is_valid()) { static real_t joy_speed = 10; PhysicsServer3D *ps = PhysicsServer3D::get_singleton(); - Transform t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM); + Transform3D t = ps->body_get_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM); t.origin += Vector3(joy_speed * joy_direction.x * p_time, -joy_speed * joy_direction.y * p_time, 0); ps->body_set_state(mover, PhysicsServer3D::BODY_STATE_TRANSFORM, t); }; - Transform cameratr; + Transform3D cameratr; cameratr.rotate(Vector3(0, 1, 0), ofs_x); cameratr.rotate(Vector3(1, 0, 0), -ofs_y); cameratr.translate(Vector3(0, 2, 8)); @@ -355,7 +355,7 @@ public: Dictionary capsule_params; capsule_params["radius"] = 0.5; capsule_params["height"] = 1; - Transform shape_xform; + Transform3D shape_xform; shape_xform.rotate(Vector3(1, 0, 0), Math_PI / 2.0); //shape_xform.origin=Vector3(1,1,1); ps->shape_set_data(capsule_shape, capsule_params); @@ -368,7 +368,7 @@ public: ps->body_add_shape(character, capsule_shape); ps->body_set_force_integration_callback(character, callable_mp(this, &TestPhysics3DMainLoop::body_changed_transform), mesh_instance); - ps->body_set_state(character, PhysicsServer3D::BODY_STATE_TRANSFORM, Transform(Basis(), Vector3(-2, 5, -2))); + ps->body_set_state(character, PhysicsServer3D::BODY_STATE_TRANSFORM, Transform3D(Basis(), Vector3(-2, 5, -2))); bodies.push_back(character); } @@ -383,7 +383,7 @@ public: PhysicsServer3D::ShapeType type = shape_idx[i % 4]; - Transform t; + Transform3D t; t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i); t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6); @@ -395,7 +395,7 @@ public: } void test_activate() { - create_body(PhysicsServer3D::SHAPE_BOX, PhysicsServer3D::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true); + create_body(PhysicsServer3D::SHAPE_BOX, PhysicsServer3D::BODY_MODE_RIGID, Transform3D(Basis(), Vector3(0, 2, 0)), true); create_static_plane(Plane(Vector3(0, 1, 0), -1)); } |