CPP SIM Samples
您应该升级到
This demo contains a set of samples addressing the specific needs.本演示包含一组处理特定任务的示例。
RopeRope#
This set of samples demonstrates how to create ropes using an arbitrary set of points and joints between them. This approach can be used to create any kind of rope or even a net consisting of a number of ropes, a wire, or a primitive cloth.这组示例演示了如何使用任意一组点和它们之间的连接来创建绳索。这种方法可以用来制作任何种类的绳子,甚至是由许多绳子组成的网;或是一根电线,或是一块简单的布。
You can use the sample ropes as a basis for your specific task by configuring their parameters as required.您可以根据需要配置示例绳索的参数,将其作为特定任务的基础。
Indices for segments are generated randomly to avoid a linear accumulation of error in joints.为避免关节误差的线性累积,随机生成线段指标。
CraneCrane#
This sample demonstrates how to imitate a crane with sling ropes transferring an object. The scene contains the manipulator with the ropes connected to it. Ropes are also connected to the load, which has BodyRigid assigned. The connection points are set via AttachPoint.这个例子演示了如何模仿起重机用吊索转移一个物体。场景中有连接着绳子的机械手。绳索也连接到负载上,它具有BodyRigid物理体。连接点是通过AttachPoint设置的。
You can move the load around the scene by dragging the manipulator with the mouse, and make it interact with the wall also available in the scene.您可以通过鼠标拖动机械手在场景中移动负载,并使其与场景中可用的墙壁进行交互。
Physics is simulated at 120 fps with 10 iterations to adjust the distance between points.物理以120 fps的速度模拟,并进行10次迭代以调整点之间的距离。
The physics update for the load is adjusted by impulses to ensure proper interaction with the environment.负载的物理更新通过脉冲进行调整,以确保与环境的适当交互。
WiresWires#
This sample illustrates how to create wires using the RopeSystem component. You can change the wire diameter value and generate a wire mesh based on a new value. The plane available in the scene can be moved to make the wires swing.这个示例说明了如何使用 RopeSystem 组件创建连线。您可以更改线径值并根据新值生成钢丝网。场景中可用的飞机可以移动,使电线摆动。
Simulating wires doesn't require a big number of physics iterations and fps, as they don't move across the scene, only swing. However, if wires in your scene are used mostly for decorative reasons and do not require any physical response, consider using a static mesh to save performance.模拟电线不需要大量的物理迭代和fps,因为它们不会在场景中移动,只会摆动。但是,如果场景中的电线主要用于装饰,不需要任何物理响应,请考虑使用静态网格来节省性能。
SSLSocketSSLSocket#
This sample illustrates the implementation of message exchange with a server through an SSL connection.此示例演示了通过SSL连接与服务器进行消息交换的实现。
It contains two windows: one representing the server, and the other one — the client.它包含两个窗口:一个代表服务器,另一个代表客户端。
To exchange messages, you need to run the server first (click the Run button in the Server window), then connect the client (use the Connect button in the Client window). Then you can type messages in the message areas and click Send.要交换消息,需要首先运行服务器(单击Server窗口中的Run按钮),然后连接客户端(使用Client窗口中的Connect按钮)。然后,您可以在消息区域中键入消息并单击Send。
VehicleVehicle#
This sample showcases a new High-Level Car Physics System. To learn more on using the system to create your own wheeled vehicle simulation please refer to this article.这个示例演示项目展示了一个新的高级汽车物理系统。要了解有关使用该系统创建自己的轮式车辆模拟的更多信息,请参阅本文.
Features特征#
- Setting engine's power and resistance curves, as well as idle speed (RPM).设置发动机的功率和阻力曲线,以及怠速 (RPM)。
- Gearbox simulation (manual and automatic) enabling you to adjust throttle and speed values for shifting gears along with transition time, as well as to set the number of gears and configure gear ratios.变速箱模拟(手动和自动)使您能够调整换档时的油门和速度值以及转换时间,以及设置档位数量和配置传动比。
- Mathematical wheel model for more realistic steering, enabling simulation of forces affecting the rotating wheel, along with an ability to adjust suspension travel distance, spring, and damping values.用于更逼真转向的数学车轮模型,能够模拟影响旋转车轮的力,以及调整悬架行程距离、弹簧和阻尼值的能力。
- Easy setup of steering and driving axes along with capability to turn the differential lock on and off.转向和驱动轴的轻松设置以及打开和关闭差速锁的能力。
- Switching between different views (driver's view, external camera, etc.).在不同视图(驾驶员视图、外部摄像头等)之间切换。
- Simulation of various surface conditions (such as dry, wet, snow-covered, or icy road, mud, and so on).模拟各种表面条件(如干燥、潮湿、积雪或结冰的道路、泥泞等)。
- A set of debug windows displaying information on all vehicle parameters in real time.一组实时显示所有车辆参数信息的调试窗口。
Fine-Tuning the Wheel Joystick微调方向盘操纵杆#
If you use a wheel device, you might need to readjust the demo settings to control the vehicle properly.如果您使用车轮装置,您可能需要重新调整演示设置以正确控制车辆。
- Run the demo and press F3 to visualize the axes.运行演示并按 F3 以可视化这些轴。
- Check the controls status — which axis each control corresponds to.检查控件状态——每个控件对应哪个轴。
- If the controls mismatch, open the demo project in UnigineEditor to reconfigure them. Find the joystick_input node, it has the car_joystick_input property assigned. Adjust the Joystick Axis parameter where required.如果控件不匹配,在UnigineEditor中打开演示项目以重新配置它们。找到 joystick_input 节点,它分配了 car_joystick_input 属性。在需要的地方调整 Joystick Axis 参数。
访问演示项目源代码#
您可以学习和修改此演示的源代码来创建自己的项目。 要访问源代码,请执行以下操作:
- 在Demos部分中找到CPP SIM Samples演示并点击Install(安装)(如果您尚未安装)。
- 安装成功后,demo会出现在Installed部分,您可以点击Copy as Project基于此创建项目 演示。
- 在打开的 Create New Project 窗口中,在相应字段中输入新项目的名称,然后单击Create New Project.
- 现在您可以点击Open Code IDE查看和修改默认IDE中的源代码,或者点击Open Editor打开项目 在 UnigineEditor中。