Browse Source

17_SceneReplication: create the first ball in front of the camera, not behind it

1vanK 3 years ago
parent
commit
652ec2cdb5

+ 1 - 1
Source/Samples/17_SceneReplication/SceneReplication.cpp

@@ -268,7 +268,7 @@ Node* SceneReplication::CreateControllableObject()
 
     // Create the scene node & visual representation. This will be a replicated object
     Node* ballNode = scene_->CreateChild("Ball");
-    ballNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 5.0f, Random(40.0f) - 20.0f));
+    ballNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 5.0f, -Random(40.0f) + 20.0f));
     ballNode->SetScale(0.5f);
     auto* ballObject = ballNode->CreateComponent<StaticModel>();
     ballObject->SetModel(cache->GetResource<Model>("Models/Sphere.mdl"));

+ 1 - 1
bin/Data/LuaScripts/17_SceneReplication.lua

@@ -200,7 +200,7 @@ end
 function CreateControllableObject()
     -- Create the scene node & visual representation. This will be a replicated object
     local ballNode = scene_:CreateChild("Ball")
-    ballNode.position = Vector3(Random(40.0) - 20.0, 5.0, Random(40.0) - 20.0)
+    ballNode.position = Vector3(Random(40.0) - 20.0, 5.0, -Random(40.0) + 20.0)
     ballNode:SetScale(0.5)
     local ballObject = ballNode:CreateComponent("StaticModel")
     ballObject.model = cache:GetResource("Model", "Models/Sphere.mdl")

+ 1 - 1
bin/Data/Scripts/17_SceneReplication.as

@@ -217,7 +217,7 @@ Node@ CreateControllableObject()
 {
     // Create the scene node & visual representation. This will be a replicated object
     Node@ ballNode = scene_.CreateChild("Ball");
-    ballNode.position = Vector3(Random(40.0f) - 20.0f, 5.0f, Random(40.0f) - 20.0f);
+    ballNode.position = Vector3(Random(40.0f) - 20.0f, 5.0f, -Random(40.0f) + 20.0f);
     ballNode.SetScale(0.5f);
     StaticModel@ ballObject = ballNode.CreateComponent("StaticModel");
     ballObject.model = cache.GetResource("Model", "Models/Sphere.mdl");