Jump to content

Search the Community

Showing results for tags 'C#'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to UNIGINE Forums
    • News & Announcements
    • Getting started
  • Development
    • Content Creation
    • World Design
    • Rendering
    • Animation
    • Physics, Navigation and Path Finding
    • UI Systems
    • Sound & Video
    • Editor
    • C++ Programming
    • C# Programming
    • Networking
    • Sim IG (Image Generator)
    • VR Discussions
    • General
  • Improving UNIGINE
    • Documentation
    • Feedback for UNIGINE team
    • Bug Reports
    • Unigine SDK Beta feedback
  • Community
    • Add-on Store (https://store.unigine.com/)
    • Showcase
    • Collaboration
    • Tools, Plugins, Materials & Tutorials
    • General Discussions
  • Legacy
    • UnigineScript

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

  1. I have imported an FBX with animation data. The animation plays when selecting preview animation. On runtime the FBX is idle. How do I play the animation when runtime starts? Thanks.
  2. private void CameraPosition(){ vec3 targetPosition = cameraTarget.Position; vec3 camPosition = node.Position; if(Input.IsKeyPressed(Input.KEY.W)){ Log.Message("Input Key is Presseds"); camPosition = targetPosition; Log.Message("Camera Target Position. " + targetPosition + "/n"); Log.Message("Camera Position. " + camPosition + "/n"); } Log.Message("Camera Target Position. " + targetPosition + "/n"); Log.Message("Camera Position. " + camPosition + "/n"); }
  3. Is it possible to create a component using an IDE with a generated GUID? Or should components be created only through the editor?
  4. I've been looking for an engine to migrate to from unity and so far unigine seems to be a really good choice but i cant quite get my head around intersections and all their different types I'm making a racing game and the tire/suspension script relies on a spherecast (used spherecast instead of a normal raycast for a smooth transition of the wheel on pointy terrain), here is a snippet of it if (Physics.SphereCast( new Vector3(transform.position.x, transform.position.y + radius, transform.position.z), radius, -transform.up, out wheelGroundHit, suspensionDistance + radius, roadLayer.value)) { ///////////// //////////// /////////// Vector3 position = transform.position - transform.up * wheelGroundHit.distance; compression = 1f - (wheelGroundHit.distance - radius) / suspensionDistance; camber = Vector3.Angle(Vector3.ProjectOnPlane(wheelGroundHit.normal.normalized, dummyWheel.transform.forward), dummyWheel.transform.up); toe = Vector3.Angle(Vector3.ProjectOnPlane(wheelGroundHit.normal.normalized, dummyWheel.transform.right), dummyWheel.transform.up); ////////////// ////////////// ////////////// visualWheel.transform.position = transform.position - transform.up * (wheelGroundHit.distance - radius); } What i cant quite recreate with intersections is setting a distance limit and reading the current ray length, basically anything that that uses wheelGroundHit in the script above would really appreciate some guidance, thanks in advance
  5. I create a new C# project. I press play, the build fails with 1 error. This does not happen on another machine I use. I tried: Installing .NET 6 SDK, as well as 7. Installing Mono. Installing .NET Core 3. Restarting. Creating another project. Reinstalling the engine. Why is it even looking for this?: Unable to find fallback package folder 'C:\Users\Max\AppData\Roaming\Godot\mono\GodotNuGetFallbackFolder' Any help would be appreciated. Here is the full error text: Running ' dotnet build -c Debug --no-restore C:/Users/Max/Desktop/Unigine/unigine_project/unigine_project.csproj ' command MSBuild version 17.7.1+971bf70db for .NET C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Users\Max\AppData\Roaming\Godot\mono\GodotNuGetFallbackFolder'. [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable`1 packageFolders) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] Build FAILED. C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: The "ResolvePackageAssets" task failed unexpectedly. [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Users\Max\AppData\Roaming\Godot\mono\GodotNuGetFallbackFolder'. [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable`1 packageFolders) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] C:\Program Files\dotnet\sdk\7.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\Max\Desktop\Unigine\unigine_project\unigine_project.csproj] 0 Warning(s) 1 Error(s) Time Elapsed 00:00:00.54
  6. I need to receive UDP data and create nodes dynamically. public override bool Init() { UDPClient = new UDP(); UDPClient.OnReciveDate += InitModel; task = Task.Run(() => { UDPClient.Recive(); }); return true; } private void InitModel(byte[] buf) { try { var res = Util.BytesToStruct(buf); NodeReference node = new NodeReference("capsule.Node"); n.Name = res.Id; } catch (Exception ex) { Log.ErrorLine(ex.Message); Log.ErrorLine(ex.StackTrace); } }
  7. I have some code I use for test that adds a web interface to my worlds that I thought I would share. I created a little demo project that moves a cylinder around from a browser and reports on clicked objects. I'm still pretty new to Unigine and I'm not a programmer, so no guarantees :). You should run this from Visual Studio. Sometimes running from the editor doesn't release all resources and you'll need to restart the editor. Also, if you keep your console window open it will hang Unigine. (Just close the console, or "Press any key to continue"). The tester is based on a two channel WebSocket connection. To enable this the project needs to use the Web SDK. The project file has: <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net5.0</TargetFramework> <LangVersion>10.0</LangVersion> <Nullable>enable</Nullable> <RootNamespace>UWeb</RootNamespace> <StartupObject>UWeb.Program</StartupObject> ... The file "Socket.cs" has the C# webhosting and socket parts. "Script.Bios.js" has the main browser code. The socket parts are: self.AsyncFunction = Object.getPrototypeOf(async function () { }).constructor; //::Fragment:ControlSocket self.control = new WebSocket(location.origin.replace('http', 'ws') + "/"); control.onopen = () => { control.send(context.name); }; control.onmessage = async (msg) => { try { s = await (new AsyncFunction(msg.data))(); control.send(!(s) ? "success" : s); } catch (e) { control.send(`Fail: ${e}`); } }; //::Fragment:TransitSocket self.transit = new WebSocket(location.origin.replace('http', 'ws') + "/Transit"); transit.onopen = () => { transit.send(context.name); }; The control socket channel executes JavaScript sent from Unigine/App. The transit channel sends messages from the browser. The startup code goes in main. Sockets_ = new(new(root, 5001, WebReceiver, BrowserBios())); _ = SetForegroundWindow(FindWindow(null, "UWeb")); Sockets.Control.Say("console.log('success')"); The World part consists of a simple component "Mover". Mover exposes a Target Port (just a public field here). On frame, the mover checks to see if the Target position is different than the current position. If so, it moves to the new position. When it gets there it sends a notice that is shown in the browser. The zip contains a project. I've also attached some of the key files. Reminder that this should be run from Visual Studio, not the editor. TestFixture.zip main.cs Mover.cs Script.bios.js Socket.cs
  8. ShowInEditor attribute doesn't work

    Hello everyone! I have such problem: ShowInEditor doesn't work, if i use classes(E.g. interface) from other project(but they are in same solution). My project structure: Test Library is a simple class library TestProject is unigine app After it I modify my Component like this I have success build, there is nothing on my component But when I remove intefrace from TestScript everything works perfect How can I fix this?
  9. How do I delay the execution of any method? So that when I called some method, it would not be executed immediately, but after n time.
  10. Hi; I'm investigating replacements for our current 3D rendering system. I'm currently looking at Unigine. I'm seeing videos or tutorials on how to create a new C# project but i can't find anything on how to add it to an existing project. Another question. Our application is a winforms and a WPF control to host the existing 3D Rendering control. How can you incorporate unigine into a WPF control? Shawn
  11. Я начинающий в этом движке и не как ни могу понять как узнать позицию обьекта в пространстве, всю документацию пересмотрел и так и не понял как это сделать. Может я просто не могу найти тот класс который мне нужен? using System; using System.Collections; using System.Collections.Generic; using Unigine; [Component(PropertyGuid = "5ff39bf967441504a8a79c93dfaf78d64f635a3d")] public class Test : Component { private void Update() { Node node = World.GetNodeByName("Cuboid"); float worldPos = (float)node.GetWorldDirection(MathLib.AXIS.X); if (Input.IsKeyUp(Input.KEY.E)) { float TransformX = worldPos + 1.0f; Log.Message("Глобальная позиция:" + worldPos + "\n"); Log.Message("Координаты оси X:" + TransformX +"\n"); node.WorldTranslate(TransformX, 0.0f, 0.0f); } } }
  12. I have an inventory in the game and I want that when opening this inventory, the mouse becomes free to move, and when the inventory closes, the cursor is fixed in the center of the screen. At the same time, it is desirable that in both cases the cursor is visible.
  13. How Can I setup Visual Studio 2019 For Unigine Support? Whenever I try to edit my code in visual studio i dont find any suggestion or anything to help me with,that doesn't show any error ,or any classes, like it's blank, i cant code in any IDE,not visual studio not visual studio code, IDE doesn't catch any classes of unigine what to do?
  14. Hello, im trying to switch between animations when pressing a key but it is not working: the only key that works is D because the 'idle' animation is set on layer 0, but the others are not working also the animation does not restart, it looks like it picks it up from a specific point as if the animation is still playing in the background. i saw the examples of 'AnimationAdditive' and 'SimpleAnimationPlayer' but i want to change from 1 animation to the other, not combine them. can somebody help me with this?
  15. Gui vs GuiObject

    Hi, Using V2.12.0.2 C# Components i am not able to get the same results from GuiObject as from adding object to Gui.Get() What am i doing wrong? Clean test project is attached. PS: What where the 2 folders you needed to debug project? unigine_UI_Test_Project.zip
  16. Basic example UI component

    Hi, I have been working on C# component for UI. Just finished translating the Unigine::Widgets::Window example from Uniginescript to C# in the OpenGameMenu() function. So I thought to share my result and thought. The widget system has some good things to it and I easily see it becoming a great system. - I can’t wait to see wat I’m able to do with the floating UI’s (next step) That being said it needs some TLC. - More C# examples (in the documentation) and some corrections in the docs. - Alignment and overlapping could use a upgrade. - A actual component set or UI designer So here you are able to find my component GameUI.csv0.1 to get started quickly. Features - @ developers comments - It is able to add, remap default key and mouse bindings. - It handles the mouse state. - Able to close the app. - And gives an example of a lot of widgets, resizing, Widget Calllbacks. Known issues. - Not able to add checkbox to menubox PS: I’m a beginner so don’t take everything to seriously. And coding advise is welcome
  17. [SOLVED] new Material();

    Hi how do i create an new material where i'm able to set the albedo color true code? I am able to clone a material (NOT base_mesh) and set its metalness. V2.12.0.1 Material mat = Materials.FindMaterial("Cone_material").Clone("mesh_base_0"); mat.SetParameterFloat("metalness", 1.0f); // mesh.SetMaterialParameterFloat4("Albedo_color_multiplier",vec4.BLACK,0); // mesh.SetMaterialParameterFloat4("diffuse_color",vec4.BLACK,0); // mesh.SetMaterialParameterFloat4("albedo",vec4.RED,0);
  18. Hi, I want to change the IntersectionMask of a Node true c# code. I found how to change the PhysicsIntersectionMask. drop_item.ObjectBody.GetShape(0).PhysicsIntersectionMask = 2; The object i want to manipulate is a Cylinder BodyRigid created in the Editor. Thanks
  19. Hi, when using "public BodyRigid nodename" the editor does not show the property field. ComponentClass supports Node and Unigine.Component and not Physics-Related Classes. Is there code to validate the node type? Or to get direct feedback in the editor if the selected .node is not acceptable? This is my current code, it works and keeps the program from crashing on Init. General help and advise is always welcome. public Node bouncing_node; private BodyRigid bouncing_body; private void Init() { if(bouncing_node) { if(bouncing_node.NumChildren > 0) { var child = bouncing_node.GetChild(0); if(child.ObjectBodyRigid) { bouncing_body = bouncing_node.GetChild(0).ObjectBodyRigid; } } } } private void UpdatePhysics() { if(bounce_triggerd) { bounce_triggerd = false; if (bouncing_body) { bouncing_body.AddForce(vec3.UP * bounce_power); } } }
  20. Hi, When adding a dummy_node under the default first_person_controller the position does not automatically update. To solve this I created a component to attach using Unigine; [Component(PropertyGuid = "cb0e1963a4eeaf66d7667f8d783a9b88e1a90947")] public class set_world_partner : Component { public String partner_name = "first_person_controller"; private Node partner; private void Init() { partner = World.GetNodeByName(partner_name); node.SetWorldParent(partner); } } Am I missing something?
  21. How to switch animation

    Could someone help me? I need to change animation I'm using C #
  22. Hi everyone, How to Access White Color in Settings Window? I searched , you can help me Thank you
  23. MathLib.Lerp Bug

    Hi Unigine Team, I verified MathLib.Lerp , this function have a bad bug. If the distance from the origin to the destination increases, The shooting point to the destination happens with a fast time interval! this is not correct! While this process should be uniform as a third parameter(speed*Game.Ifps). For example : The starting distance to the destination is 10 meters and the particle travels this distance in 2 seconds For example :The starting distance to the destination is 100 meters and the particle travels this distance in 20 seconds I think this function needs to be reviewed , or at least create another function, according to me, so that missiles and rockets can be designed. Thank you
  24. SplineGraph in C#

    Hey there I have a problem. I want to create a spline via C# so I thought it is a good idea to transfer the sample Spline (C++) into C# but my Spline wont render and I have no idea why because it should show a spline (with the Visualizer). Because when I assign the Script to a NodeDummy or so nothing happens does someone have an idea why? Code: using System; using System.Collections; using System.Collections.Generic; using Unigine; [Component(PropertyGuid = "295cde640e861673976ae9364c0e4f1d868385d8")] public class TestSpline : Component { SplineGraph spline; private void Init() { Unigine.Console.Run("show_messages 1"); //create spline garph spline = new SplineGraph(); //generate spline CreateSpline(spline); } private void Update() { // write here code to be called before updating each render frame RenderSpline(spline); } private void CreateSpline(SplineGraph splineGraph) { splineGraph.AddPoint(Rand(-10.0f, 10.0f)); splineGraph.AddPoint(Rand(-10.0f, 10.0f)); splineGraph.AddPoint(Rand(-10.0f, 10.0f)); splineGraph.AddPoint(Rand(-10.0f, 10.0f)); splineGraph.AddSegment(0, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f), 1, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f)); splineGraph.AddSegment(1, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f), 2, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f)); splineGraph.AddSegment(2, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f), 3, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f)); splineGraph.AddSegment(3, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f), 0, Rand(-10.0f, 10.0f), new vec3(0.0f, 0.0f, 1.0f)); } public void RenderSpline(SplineGraph splineGraph) { int num_segments = 50; for (int i = 0; i < splineGraph.NumSegments; i++) { vec3 startpoint = new vec3(splineGraph.GetSegmentStartPoint(i)); vec3 starttangent = new vec3(splineGraph.GetSegmentStartTangent(i)); vec3 endpoint = new vec3(splineGraph.GetSegmentEndPoint(i)); vec3 endtangent = new vec3(splineGraph.GetSegmentEndTangent(i)); Visualizer.RenderVector(startpoint, startpoint + starttangent, new vec4(1.0f, 0.0f, 0.0f, 0.3f), 0.05f); Visualizer.RenderVector(endpoint, endpoint + endtangent, new vec4(1.0f, 0.0f, 0.0f, 0.3f), 0.05f); for (int j = 0; j < num_segments; j++) { vec3 p0 = new vec3(splineGraph.CalcSegmentPoint(i, (float)j / num_segments)); vec3 p1 = new vec3(splineGraph.CalcSegmentPoint(i, (float)j + 1 / num_segments)); Visualizer.RenderLine3D(p0, p1, new vec4(1.0f, 1.0f, 1.0f, 1.0f)); } } } public vec3 Rand(float min, float max) { Random rand = new Random(); vec3 ret = new vec3(); ret.x = (float)rand.Next((int)min, (int)max); ret.y = (float)rand.Next((int)min, (int)max); ret.z = (float)rand.NextDouble(); //returns a number btwn 0.0 and 1.0 return ret; } public void MoveMesh(SplineGraph splineGraph) { float time = Unigine.Engine.TotalTime; //float t = time - Math.Floor((double)(time / spline.NumSegments)) * spline.NumSegments; float t = (float)(time - Math.Floor(time / splineGraph.NumSegments) * splineGraph.NumSegments); int segment_id = (int)t; t -= (float) segment_id; vec3 p = new vec3(splineGraph.CalcSegmentPoint(segment_id, t)); vec3 direction = new vec3(splineGraph.CalcSegmentTangent(segment_id, t)); vec3 up = new vec3(splineGraph.CalcSegmentUpVector(segment_id, t)); //mesh is not implemented still yet //mesh.setWorldPosition(p); //mesh.setWorldDirection(direction, up); } }
  25. WorldRotate(vec3) scales object

    Steps: -Add the following component to a primitive box -Use space / enter to trigger WorldRotate using System; using System.Collections; using System.Collections.Generic; using Unigine; [Component(PropertyGuid = "24c7af91cfafa3bcc0f32beb363ad04ec4089b55")] public class BugTester : Component { private void Update() { // write here code to be called before updating each render frame if (Input.IsKeyDown(Input.KEY.SPACE) || Input.IsKeyPressed(Input.KEY.RETURN)) { node.WorldRotate(new vec3(0,0,0.1f)); } Log.Message("rotation " + node.GetRotation()); Log.Message("position " + node.Position); Log.Message("scale " + node.Scale); } } With a Z rotation input vector the cube scales down on X and Y axises until the scale and rotation properties turn into NaN. Unigine 2.11.0.0 Community C# (edit, seems to work the same in C++ version too) WorldRotate.mp4
×
×
  • Create New...