Modelling of Flexible Elements E.V. Afonina1, M.N. Levaya1, I.S. Levy1 cvetelena@rambler.ru|mlevaya@mail.ru|i-levyy@mail.ru 1 Bryansk State Technical University, Bryansk, Russia Flexible elements are used for modeling of various hawsers, chains, ropes, tail-ropes and other elements in the programmes of simulation. Depending on a current task a set of requirements necessary for a flexible element modeling is formulated. The article presents two methods of rope, wire, cable designing in computer games programming environment Unity3D based on the use of primitive objects. The standard design method grounded in hinge joints employment is considered. The disadvantages of a standard method are noted and two new methods of modeling are offered. The developed methods consider the requirements necessary for the solution of the task at hand, they include the reality of a scene, the interaction with surrounding objects, the possibility to specify the function of a natural sag. Two methods of modeling are compared taking into account the implementation area of programs, the reflection of physical and geometrical properties of modelled entity and the reality of a scene. Both methods meet specified requirements, however it is expedient to use one of the methods for mobile scenes, such as games, exercise machines, simulators of processes, while the other fits better for static programmes. Keywords: 3D modeling, computer graphics, flexible elements, ropes, cables, wires. 3. a small number of polygons,which is good for high 1. Introduction performance of 3D scene modeling. For clarity of the flexible element movement simulation the One of the tasks of rope, chain, hook, knot and other flexible cross-platform programming environment of computer games elements modelling is their use in the development of 3D-games, (the so-called game engine): Unity3D was chosen. The main trainer simulators and simulators, testing and training advantages of Unity3D include the presence of a visual programmes, commercials and other animation projects. development environment, cross-platform support and modular Flexible elements such as ropes and tail-ropes give system components. For nontrivial tasks, native components interesting and fun dynamics to game scenes. They can be used written in the C# or JavaScript programming language are used. for moving through levels, battles taking place in arenas and also The difficulties appearing when working with multicomponent for retrieving items. In various specified 3D simulators flexible schemes and problems in connecting external libraries, both elements can be employed to simulate wires and cables of leading to a sharp drop in performance, can be considered as overhead power lines or various devices for both carrying out disadvantages. rescue operations and, for example, lifting cargos. In one form or To solve this problem Unity 3D has a standard mechanism another, flexible elements are used practically in all 3D scenes. based on the use of the component HingeJoint. In the study of the mechanical properties of wires, ropes, HingeJoint is a component that connects two objects tipping cables, geometric models do not raise a demand of reality. the scale and allows them to rotate around a specific point or axis. Depending on the scope of application and study of the model, When creating a flexible element, primitive objects like spheres modeling methods can vary significantly [1, 3-4]. and capsules were used. Each sphere connects two capsules using the HingeJoint component. At the two ends of the flexible 2. Existing methods of modeling flexible element there are posts with the specified IsKinematic property. elements It is assumed that they will not be affected by the force of the By “flexible element” we shall basically mean any segment, flexible element. These posts are also connected to the extreme the main characteristics of which are length, strength and capsules by a hinge joint. flexibility. These include hawsers, ropes, chains, wires, cables As a result of modeling, we obtain a flexible element and other elements, which can connect two or more objects. To presented in Fig. 1. give realism to the scenes flexible elements should reflect physical properties of real objects, for example, oscillation under impulse load, natural sagging at the horizontal orientation of a segment, etc. So far a certain method of creating ropes and tail-ropes in three-dimensional modeling programmes has been developed. Modeling of games, feature and instructional films, 3D characters of advertising are performed in Autodesk 3ds Max, Cinema 4D, Sculptris, Icon, Sketch Up, Sweet Home 3D, Visicon, Paint 3D, Blender 3D and others [2, 5, 6]. But the functionality of each of these programs is well designed to solve certain types of tasks, and is not suitable for mmodeling of specialized scenes due to its unability of either reflecting physical properties of such flexible Fig.1. Simulation of a rope (tail-rope) using the HingeJoint objects like wires and chains or interacting with other elements component of the scene. When creating production processes of training simulators This approach has its drawbacks: and simulators, building of ropes, tail-ropes, wires, models 1. The employment of primitives (spheres and capsules), that should meet the following requirements: makes creating of real objects difficult. 1. reflection of physical properties (elasticity, flexibility, 2. The uprising of gaps between primitives appearing at the oscillation in motion, etc.); maximum amplitude of oscillation. 2. realistic appearance of modeling object; Copyright © 2019 for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). 3. The inability of element staying. Less sagging of the enter the posing mode, and set the "skeleton of bones" rotation element requires the change of the primitives' number, and the about different axes (Fig. 4). display quality of the flexible element is lost. In the development of a new method of flexible elements modeling, the set task is to avoid these disadvantages. 3. Methods of modeling flexible elements taking into account specified requirements The first of the possible methods of designing lies in the fact that flexible element should be a single mesh. Mesh or baseline grid is a term used to denote a total of top elements, edges, and polygons that make up a single 3D object. A rope object is created in any 3D editor using primitives, for example, cylinders. Then tools of object deformation by means of armature (skeleton) are employed. The more "bones" the skeleton has, the more the Fig.4. Mode of the flexible element posing. simulated object will resemble the movement of a flexible To simulate the motion of a flexible element the C#script element. By using this method it is possible to get rid of the first component is added to the created object. The model is then two disadvantages described above, but at the same time it imported into Unity3D. requires bringing in additional programmes. The second method is connected with using the standard The following components must be specified for each part of LineRenderer component of the Unity3d programme. This the flexible member: component consists of an array of two or more points of three- 1. Rigidbody (a solid body). dimensional space and successively draws a straight line between With RigidBody, objects can interact with each other taking each pair of points (that is, at three or more points a polyline is into account physical properties by means of the programme obtained), therefore the created object looks seamlessly describing physical state, titled NVIDIA PhysX. For the body, (integrally). The use of this method makes the simulation of the you can set its mass, the value of gravity, the forces acting on it, physical properties of the object possible. the torque. To implement the first method we take advantage of 3D 2. SphereColider (collider). The SphereColider component editor of the Blender graphics package. Blender 3D editor has determines the shape of an object (in this case it is the shape of a enough feature set to create 3D models, videos with complex sphere),which is necessary for calculating mechanical collisions scenes, sculpturing and creating realistic object visualizations. with other objects. This component is transparent, and the To model a rope (tail-rope) a standard cylinder object should geometric shape may not match the exact shape of the object. be designed, which is then split into parts in edit mode (Fig. 2). 3. DistanceJoint3D. This designed component allows Fig.2. Rendering of flexible element. calculating physical properties of the interaction between objects, such as speed (velocity), distance (distance), the force that must be given to the object to change the position (spring), the attenuation of the object during its perturbation (damper), etc. 4. The "private void AddChildren (Transform parent)" function adds created components for each part of the flex element. The calculation of physical properties of the relationship between the parts of the rope is made separately in the "void FixedUpdate" function of the "DistanceJoint3D" component, which is called each time when the simulation scene frame is updated. As a result, we obtain a simulation of a flexible body on the scene shown in Fig. 5. Fig.5. Modeling of the physical properties of a flexible element. The next step is to add a standard object “armature” Modeling by using the second method is aided by standard (skeleton) to the project and create a child object of CAD fittings component LineRenderer (render lines) programmes Unity3d. (“bone”) for each part of the cylinder (Fig. 3). To do this, an empty object is added to the scene and the Fig.3. CAD fittings (armature) of flexible element. LineRenderer component is "attached" to it. Going forward it is imperative to bind the “bones” of the To simulate the motion of a flexible element, a C#script is armature to the designed object. The resulting object can freely added to the object. In the developed script, you can change the rotate its parts around three axes. For clarity it is necessary to following properties: 1. Pointsinlinerenderer: the number of points in the and other it is required a certain texturing to the model [7, 8] to LineRenderer component defines the rope (the smaller the create the vividness of the scene. number of points, the greater the performance of frame-by-frame rendering of the rope physics). 4. Conclusion 2. Sag Amplitude is a property that determines how much the rope will sag in the middle. The developed methods meet the specified requirements, 3. Sway Multiplier is a property that estimates how much have positive features and preferential scope of use [1, 9, 10]. the rope will deviate in different coordinates. A significant advantage of the first method is the presence in 4. Sway X Multiplier is a deviation of the rope in the local all parts of the object of the rope collider component, which coordinate system by the x coordinate. coincides with the shape of the rope. This makes the interaction 5. Sway Y Multiplier is a deviation of the rope in the local with other objects in the scene easier. The interaction is carried coordinate system by the Y coordinate. out by means of add-in physical properties determinant of the 6. Sway Frequency is a property that determines the Unity 3D programme with a number of settings. frequency of the rope vibrations. This method is useful for ropes (or other flexible elements) 7. End Point Transform is a property that determines the that often interact with other objects in the scene, such as catapult coordinates of the object to which the other end of the rope will tension harnesses (in games, simulators, process simulators, etc.). be attached (it is desirable for the object being empty). The advantage of the second method is a simpler calculation The coordinates of the points of the LineRenderer component of the rope movement, since a single object is used to form a are calculated separately in the “void Animate” function, which flexible element, which contributes to the programme efficiency. is called each time when the simulation scene frame is updated. Besides it there is no need to use additional programmes to build The calculation is made taking into account all the above- the rope. This method is good in static scenes, as it is shown in mentioned properties. the example of high-voltage power lines. The result is a simulation of the physical properties of the flexible element in the scene shown in Fig. 6 with the amount of 5. References: sagging of 5- Unity meters and in Fig. 7: 1Unity- meter. [1] Voloboy А., Galaktionov V. Visualisation technologies in the problems of modern industry//Scientific visualization.- 2013.- Vol.5. № 4.-pp. 31-46. [2] Ermakov E., Mitin S., Solving kinematic problems of models and units of mechanisms under geometric constraints [Article] // GraphiCon.- 2016 [Proc. of the international scientific conf.]: Russia, Nizhny Novgorod, Sept.,19–23,2016- pp. 77-79. [3] Zakharova А.А., Vekhter Е.V., Shklyar А.V. Methods for solving data mining tasks when using analytical visual models // Scientific visualization. – 2017. – Vol. 9. – № 4. – pp. 78-88. [4] Bednarcyk B.A., Stier B., Simon J.-W., Reese S., Pineda E.J. Meso- and micro-scale modeling of damage in plain weave composites. Composite Structures. 2015. Vol. 121. Fig.6. Simulation of the physical properties of a flexible pp. 258 − 270. element with a sagging of 5 Unity-meters [5] Behera B.K., Dash B.P. Mechanical behavior of 3D woven composities. Materials & Design. 2015. Vol. 67. pp. 261 − 271. Fig.7. Simulation of the physical properties of a flexible [6] Brodlie, K.; Osorio, R.A.; Lopes, A. A review of element with sagging at 1 Unity-meter. uncertainty in data visualization. In Expanding the As a result, both developed methods eliminate the Frontiers of Visual Analytics and Visualization; Springer: disadvantages of the standard modeling mechanism of the Berlin / Heidelberg, Germany, 2012; pp. 81–109. flexible element and meet the necessary requirements. The [7] Geuzaine С., Remacle J.-F. Gmsh: a three-dimensional finite element mesh generator with built-in pre- and postprocessing facilities // International Journal for Numerical Methods in Engineering, Vol. 79, i. 11, pp 1309- 1331, 2009. [8] Kirby R., Silva C. The need for verifiable visualization // IEEE Computer Graphics and Applications, 28(5) Sept. 2008. pp. 78–83. [9] Parsons E.M., King M.J., Socrate S. Modeling yarn slip in woven fabric at the continuum level: Simulations of ballistic impact. Journal of the Mechanics and Physics of Solid.- 2013-. Vol. 61.pp. 265 − 292. [10] Zakharova, A.A., Shklyar, A.V. Visual presentation of different types of data by dynamic sign structures. Scientific visualization Vol.8., № 4 ,pp.28-37 (2016). designed objects appear as a whole. There is also a range of settings for physical properties adjusting. When specifying a particular type of flexible element such as wire, rope, tail-rope