-
Posts
220 -
Joined
-
Last visited
Profile Information
-
Location
Kaiserslautern, Germany
Recent Profile Visitors
16,051 profile views
Andy90's Achievements
-
I updated today the controller to a new version. I adjusted some parameters that the camera looks more like an isometric view. MouseMovementController.h #pragma once #include "UltraEngine.h" #include "../BaseComponent.h" using namespace UltraEngine; class MouseMovementController : public BaseComponent { public: std::weak_ptr<NavMesh> navmesh; std::shared_ptr<Camera> camera; std::shared_ptr<NavAgent> navagent; string runanimation; string idleanimation; Vec3 destination; MouseMovementController(); virtual void Start(); virtual void Update(); virtual void Collide(std::shared_ptr<Entity> collidedentity, const Vec3& position, const Vec3& normal, const float speed); virtual bool ProcessEvent(const Event& e); virtual bool Load(table& properties, std::shared_ptr<Stream> binstream, std::shared_ptr<Scene> scene, const LoadFlags flags, std::shared_ptr<Object> extra); virtual bool Save(table& properties, std::shared_ptr<Stream> binstream, std::shared_ptr<Scene> scene, const SaveFlags flags, std::shared_ptr<Object> extra); virtual std::shared_ptr<Component> Copy(); virtual std::any CallMethod(shared_ptr<Component> sender, const WString& name, const std::vector<std::any>& arguments); }; MouseMovementController.cpp #pragma once #include "UltraEngine.h" #include "MouseMovementController.h" using namespace UltraEngine; bool PickFilter(std::shared_ptr<Entity> entity, std::shared_ptr<Object> extra) { if (entity->As<Terrain>()) { return true; } return false; } MouseMovementController::MouseMovementController() { name = "MouseMovementController"; } void MouseMovementController::Start() { //Listen(EVENT_KEYDOWN, NULL);// makes this component listen for keydown events from all windows auto entity = GetEntity(); ///Create the camera and attach them to the player character this->camera = CreateCamera(entity->GetWorld()); Vec3 currentcameraposition = TransformPoint(0, 15, 5, entity, nullptr); //this->camera->SetParent(entity); this->camera->SetPosition(currentcameraposition, true); this->camera->SetRotation(Vec3(45, 0, 0)); this->camera->SetFov(40); this->camera->Point(entity); auto navmesh = this->navmesh.lock(); this->navagent = CreateNavAgent(navmesh); this->navagent->SetPosition(entity->GetPosition(true)); this->navagent->SetMaxSpeed(5.0f); entity->SetPosition(0, 0, 0); entity->SetRotation(0, 0, 0); entity->Attach(this->navagent); } void MouseMovementController::Update() { auto entity = GetEntity(); auto window = ActiveWindow(); auto world = entity->GetWorld(); if (window) { ///Set the destination if the player hits the left mouse button if (window->MouseDown(MOUSE_LEFT)) { auto mousePosition = window->GetMousePosition(); auto pick = this->camera->Pick(window->GetFramebuffer(), mousePosition.x, mousePosition.y, 0, false, PickFilter); if (pick.success) { this->destination = pick.position; } } ///Move to the destination if the destination is not null if (this->destination != NULL) { if (entity->position.DistanceToPoint(this->destination) > 1.0f) { this->navagent->Navigate(this->destination); auto model = entity->As<Model>(); model->Animate(this->runanimation); } else { this->navagent->Stop(); auto model = entity->As<Model>(); model->Animate(idleanimation); this->destination == NULL; } } Vec3 offset = Vec3(-10, 15, -10); Vec3 currentcameraposition = entity->position + offset; this->camera->SetPosition(currentcameraposition, true); this->camera->Point(entity); } } void MouseMovementController::Collide(shared_ptr<Entity> collidedentity, const Vec3& position, const Vec3& normal, const float speed) { } bool MouseMovementController::ProcessEvent(const Event& e) { /*switch (e.id) { case EVENT_KEYDOWN: if (e.data == KEY_SPACE) { Print("Space key pressed"); } break; }*/ return true; } bool MouseMovementController::Load(table& properties, shared_ptr<Stream> binstream, shared_ptr<Scene> scene, const LoadFlags flags, std::shared_ptr<Object> extra) { this->runanimation = (String)properties["runanimation"]; this->idleanimation = (String)properties["idleanimation"]; auto navmesh_entity = scene->GetEntity((String)properties["navmesh"]); this->navmesh = scene->navmeshes[(int)navmesh_entity->properties["navmesh"]]; //return true; return BaseComponent::Load(properties, binstream, scene, flags, extra); } bool MouseMovementController::Save(table& properties, shared_ptr<Stream> binstream, shared_ptr<Scene> scene, const SaveFlags flags, std::shared_ptr<Object> extra) { return BaseComponent::Save(properties, binstream, scene, flags, extra); } //This method will work with simple components shared_ptr<Component> MouseMovementController::Copy() { return std::make_shared<MouseMovementController>(*this); } std::any MouseMovementController::CallMethod(shared_ptr<Component> sender, const WString& name, const std::vector<std::any>& arguments) { /*if (name == "MyMethod") { MyMethod(); return false; }*/ return BaseComponent::CallMethod(sender, name, arguments); } MouseMovementController.json { "component": { "properties": [ { "name": "runanimation", "label": "Run Animation", "value": "" }, { "name": "idleanimation", "label": "Idle Animation", "value": "" }, { "name": "navmesh", "label": "Navmesh", "value": null } ] } } Here you can find how it looks now: Watch 2024-12-12 17-12-32 | Streamable
-
Thanks for your feedback Its nice to see that it actualy helped someone.
-
Its still freezing. I face the issue again
-
Andy90 started following Cant update the Project , CS2 Textures , The only way to learn c++ is with Ultra Engine. xD and 5 others
-
I think in cs2 the use an much higher polycount then in the old games. So the use much more details. I posted an screenshot below In modern games, the environment is much more than simple boxes or geometric shapes. For this reason, I recommend using 3D models instead of brushes. Brushes are a holdover from the early days of game development, when people wanted to quickly and easily create level geometry directly in the engine because there were few specialised 3D programs available. At this time, 3DS Max was one of the few useful tools, and Blender did not play a significant role in the industry. Today this has changed. With Blender, we have a free, extremely powerful software that is capable of creating AAA-quality assets. Thanks to the continuous development of Blender and its community, developers can create highly detailed models and textures that meet the demands of modern games. I see this in my own project, Nuclear Frontiers. After talking to some friends, I realised that the lack of detail on the surfaces of my buildings was a problem. In order to create more realistic and appealing environments, the textures must be much more detailed. Modern players expect a high quality of textures, normal maps and other surface details that go beyond simple geometric shapes. in the screenshot you can see what i mean. The wall within the blender screnshot has a bit more details and it looks more interesting than just the block from the gas station.
-
What do you want to do with the CWindow ?
-
any news on this topic ?
-
I have a 3060 and have the same issue
-
Hello, if you set the pickmode to none within the new field in the physics tab it disables also the pick for the editor.
-
This sounds intresting. sadly i have not that much clue from shadows. Also there are ways for order independent transparency. Im not 100% if it will help on the performance to this problem but i found a few months ago something intresting S4385-order-independent-transparency-opengl.pdf (gputechconf.com)
-
Hello, according to the discord i post here also an bug report. I got the feeling that there is an issue with the foliage system at the moment. If you create an scene with just grass and tree's the frames drops arround 90 fps. I attached an map wich is using the nature dlc stuff so you can test it for yourself. test.zip
-
Yeah with the physics disabling and reactivating it is working. I was not expecting to do this. Maybe SetPosition() should do this allready. Or an Translate() function wich is doing this. Thanks Reep
-
Hello im not 100% sure if its a bug but it feels like it. I try to change the position for my player. But however he gets teleported back to the old position. I use a slight modifyed version of the FPS Controls. How to reproduce: Change the update function with the following code and press enter, wich sets the player to 0,0,0 and press any movement key after the position change. void FirstPersonControls::Update() { Vec3 movement; float jump = 0; bool crouch = false; auto entity = GetEntity(); auto window = ActiveWindow(); if (window) { if (!freelookstarted) { freelookstarted = true; freelookrotation = entity->GetRotation(true); freelookmousepos = window->GetMouseAxis(); } auto newmousepos = window->GetMouseAxis(); lookchange.x = lookchange.x * mousesmoothing + (newmousepos.y - freelookmousepos.y) * 100.0f * mouselookspeed * (1.0f - mousesmoothing); lookchange.y = lookchange.y * mousesmoothing + (newmousepos.x - freelookmousepos.x) * 100.0f * mouselookspeed * (1.0f - mousesmoothing); if (Abs(lookchange.x) < 0.001f) lookchange.x = 0.0f; if (Abs(lookchange.y) < 0.001f) lookchange.y = 0.0f; if (lookchange.x != 0.0f or lookchange.y != 0.0f) { freelookrotation.x += lookchange.x; freelookrotation.y += lookchange.y; camera->SetRotation(freelookrotation, true); } freelookmousepos = newmousepos; float speed = movespeed;// / 60.0f; bool jumpkey = window->KeyHit(KEY_SPACE); if (entity->GetAirborne()) { speed *= 0.25f; } else { if (window->KeyDown(KEY_SHIFT)) { speed *= 2.0f; } else if (window->KeyDown(KEY_CONTROL)) { speed *= 0.5f; } if (jumpkey) { jump = jumpforce; } } if (window->KeyDown(KEY_D)) movement.x += speed; if (window->KeyDown(KEY_A)) movement.x -= speed; if (window->KeyDown(KEY_W)) movement.z += speed; if (window->KeyDown(KEY_S)) movement.z -= speed; if (movement.x != 0.0f and movement.z != 0.0f) movement *= 0.707f; if (jump != 0.0f) { movement.x *= jumplunge; if (movement.z > 0.0f) movement.z *= jumplunge; } crouch = window->KeyDown(KEY_CONTROL); if (window->KeyDown(KEY_ENTER)) { this->GetEntity()->SetPosition(0, 0, 0); this->currentcameraposition = this->GetEntity()->position; } } entity->SetInput(camera->rotation.y, movement.z, movement.x, jump, crouch); float eye = eyeheight; float y = TransformPoint(currentcameraposition, nullptr, entity).y; float h = eye; if (y < eye) h = Mix(y, eye, 0.5f); currentcameraposition = TransformPoint(0, h, 0, entity, nullptr); camera->SetPosition(currentcameraposition, true); }
-
Sendet you via PN in discord
-
Hello, i am unable to update the project. If i do an update he wont find the vs solution anymore its related to the $PROJECTNAME.vcxproj variable.