Jump to content

ErhanK

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by ErhanK

  1. Hello there. I'm trying to get the texture path on pickinfo's surface. If I can get the path name, I'll specify the bullet impact effect from the postfix I added to the texture name (eg myTexture_wood or myTexture2_metal). But the nullptr value is returned. Here is my debug window. can anybody help?
  2. Is it correct to add the Baked lighting map from the blender cycles as an emission and diffuse shader to the leadwerks? I tried, but there's no decal on it. How would it be? Would it give such an image? Anybody try anything like that?
  3. This is my RTS project's mouse zoom code. I hope this c++ code can give you idea. float cameraDistance = 15.0f; float smoothness = 15.0f; float zoomRangeMin = 8.0f; float zoomRangeMax = 20.0f;; Vec3 playerCameraPos; Vec3 playerCameraNewPos; float scrollSpeedFPS; float mouseWheel; int getMouseWheelDirection() { int wheelReturn = 0; float mouseWheelPos = Window::GetCurrent()->GetMousePosition().z; if (mouseWheel != mouseWheelPos) { if (mouseWheelPos < mouseWheel) { wheelReturn = 2; //Wheel Down } else if (mouseWheelPos > mouseWheel) { wheelReturn = 1; //Wheel Up } mouseWheel = mouseWheelPos; } return wheelReturn; } void mouseMovement() { playerCameraPos = playerCamera->GetPosition(); playerCameraNewPos = playerCameraPos; scrollSpeedFPS = scrollSpeed * Time::GetSpeed(); if (playerCameraNewPos.y != cameraDistance) { playerCameraNewPos.y = Math::Curve(cameraDistance, playerCameraNewPos.y, smoothness / Time::GetSpeed()); } int mouseWheelDirection = getMouseWheelDirection(); if (mouseWheelDirection) { if (mouseWheelDirection == 1) { if (cameraDistance < zoomRangeMax) { cameraDistance = cameraDistance + 2; } } else if(mouseWheelDirection == 2){ if (cameraDistance > zoomRangeMin) { cameraDistance = cameraDistance - 2; } } } playerCamera->SetPosition(playerCameraNewPos); }
  4. The fbx version of your file is 6.0. It's failing. Can you try to export as version 7.4binary?
  5. Thanks. I love this feature too. I had to do it.?
  6. Of course. In the upper left corner there are rotation values related to the weapon.
  7. Thank you?! useful information for me. it's working
  8. the actual problem is here. i cant call this function.. both of them in the same class. Thanks for other reply.
  9. Hi, I have a few questions. I am using C ++. 1) For example, I have a derived entity class, and I have a derived actor class attached to this class. Pickinfo gives me an entity when the bullet hits this class. I can also access the atached actor with pickinfo.entity.GetActor (). But since it doesn't give me the class and actor I've derived, I can't call the giveHurt () function in them. 2) In the documentation, the ForEachEntityInAABBDo function can be called in main (). There is no problem. But I can't call the callback function of a class. Should I use a function pointer? world-> ForEachEntityInAABBDo(aabb, &MyClass::Callback, v); it does not work. Also I cannot call the callback function with a string. I need to solve these problems so that I can continue to improve my game. I can't get enough help from the forum. I will be glad if you help me.
  10. Anyway, this doesn't look odd because of the concept of my game. People can think of it as a ghost.
  11. this code solved the problem // tmpX and tmpY are global float x = 0; x = mouseDifference.y / mouseSensitivity; tmpX += x; if (tmpX > 20) { tmpX = 20; } else if (tmpX < -20) { tmpX = -20; } float y = 0; y = mouseDifference.x / mouseSensitivity; tmpY += y; if (tmpY > 60) { tmpY = 60; } else if (tmpY < -60) { tmpY = -60; } //CONVERT TO VECTOR Vec2 wpnRot; wpnRot.x = tmpX; wpnRot.y = tmpY; // SMOOTING smoothWeaponViewRot.x = Math::Curve(wpnRot.x, smoothedHurtOffset.x, 5); smoothWeaponViewRot.y = Math::Curve(wpnRot.y, smoothedHurtOffset.x, 5); //THEN testWeapon->entity->SetRotation(camRotation); //PLAYER ROTATION testWeapon->entity->Turn(smoothWeaponViewRot); //WEAPON VIEW ROTATION //now the weapon can navigate within the boundaries of the player's angle of view, according to the movement of the mouse.
  12. This bug occurred after upgrading to version 4.6. When I apply force to it, it seems to apply it to the object in a fixed and inverse direction.
  13. Well, I'll try after the slider problem that came with 4.6 :-) thanks
  14. The posplayer is only in the if condition.
  15. I just want to make this move. (time 0.12) But this is only happening when I look at the global z direction. https://youtu.be/_6xEFmViZ8o?t=12
  16. Thank you, josh. I tried, but the result is the same. I need to think more about it.
  17. Hi. I would like to make the rotation of the gun at -45 and +45 (or less) degrees relative to that of the camera. When I limit the values, it only works according to the world coordinate. For example, when I turn a full turn to the left, I have to turn a full turn right again so that the gun rotates in the right direction. I want to do a gun control like Insurgency game. How can I fix this? Here is my code. float currentTime = Time::GetCurrent(); Vec2 currentMousePos = Window::GetCurrent()->GetMousePosition(); Window::GetCurrent()->SetMousePosition(Math::Round(Context::GetCurrent()->GetWidth() / 2), Math::Round(Context::GetCurrent()->GetHeight() / 2)); Vec2 centerPos = Window::GetCurrent()->GetMousePosition(); currentMousePos.x = Math::Round(currentMousePos.x); currentMousePos.y = Math::Round(currentMousePos.y); mouseDifference.x = Math::Curve(currentMousePos.x - centerPos.x, mouseDifference.x, 2 / Time::GetSpeed()); mouseDifference.y = Math::Curve(currentMousePos.y - centerPos.y, mouseDifference.y, 2 / Time::GetSpeed()); camRotation.x = Math::Clamp(camRotation.x + mouseDifference.y / mouseSensitivity, -90, 90); camRotation.y = camRotation.y + (mouseDifference.x / mouseSensitivity); hurtOffset.x = Math::Inc(0, hurtOffset.x, 2 * Time::GetSpeed()); hurtOffset.y = Math::Inc(0, hurtOffset.y, 2 * Time::GetSpeed()); smoothedHurtOffset.x = Math::Curve(hurtOffset.x, smoothedHurtOffset.x, 3); smoothedHurtOffset.y = Math::Curve(hurtOffset.y, smoothedHurtOffset.y, 3); bobOffset.x = Math::Inc(0, bobOffset.x, Time::GetSpeed() * 0.8f); bobOffset.y = Math::Inc(0, bobOffset.y, Time::GetSpeed()); smoothedBobOffset.x = Math::Curve(bobOffset.x, smoothedBobOffset.x, 25); smoothedBobOffset.y = Math::Curve(bobOffset.y, smoothedBobOffset.y, 25); weaponViewRot.x = Math::Clamp(camRotation.x + mouseDifference.y / mouseSensitivity, -45, 45); weaponViewRot.y = Math::Clamp(camRotation.y + mouseDifference.x / mouseSensitivity, -45, 45); smoothWeaponViewRot.x = Math::Curve(weaponViewRot.x, smoothedHurtOffset.x, 5); smoothWeaponViewRot.y = Math::Curve(weaponViewRot.y, smoothedHurtOffset.x, 5); playerCamera->SetRotation(camRotation + smoothedBobOffset + smoothedHurtOffset); testWeapon->entity->SetRotation(camRotation + smoothWeaponViewRot); if (Window::GetCurrent()->MouseDown(1)) { testWeapon->weaponShoot(); }
  18. Of course! Thanks. Because this is a loop and the last element in the list is not "info_player_start". understood :) I should practice more.
  19. Hi. I want to load the player entity position from an object in the editor. It works very well but; I want to spawn in the center of the scene when there is no object named "info_player_start". When I remove the comment lines, it always spawns at the center of the scene. I don't understand why. Here is my code... #include "Game.h" Game::Game() { loadMap(); loadEntities(); player = new Player(playerStartPosition); } Game::~Game() { delete player; } void Game::loadMap() { std::string mapname = System::GetProperty("map", "Maps/start.map"); if (!Map::Load(mapname)) Debug::Error("Failed to load map \"" + mapname + "\"."); } void Game::loadEntities() { for (const auto e : World::GetCurrent()->entities) { if (e->GetKeyValue("name") == "info_player_start") { playerStartPosition = e->GetPosition(); } /*else { playerStartPosition = Vec3(0.0f, 0.0f, 0.0f); }*/ } } void Game::Update() { player->Update(); }
  20. Really? Ok thank you. I'll try
  21. Hi, I have a question. How can I use "PostRender" in c++ for drawing a rectangle like this lua script? I did but, screen is flickering. I think this is must be in PostRender --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) local window = context:GetWindow() context:SetBlendMode(Blend.Alpha) --draw selection rectangle if ( self.beginSelectPos ~= nil and self.endSelectPos ~= nil ) then context:SetColor(1,0,0,0.5) context:DrawRect(self.beginSelectPos.x, self.beginSelectPos.y, self.endSelectPos.x-self.beginSelectPos.x, self.endSelectPos.y-self.beginSelectPos.y) context:SetColor(0,0,0,0) end
  22. Hello, I created a C++ project and I have "Game" class and "Player" class..App class is creating game class.Game class is creating Player class and player class is creating camera etc.. How i can access or reference context or window class in the player class? For example : i want to call window->GetMousePosition() in the player class.
×
×
  • Create New...