lets made a c# godot 4.4 game , it will have rts camera, lets start fromt this, so rts…
- User
lets made a c# godot 4.4 game , it will have rts camera, lets start fromt this, so rts camera means it will move with a w s d keys , rotate with z and c keys , all will be setup to action inputs, it will have zoom in zoom out, smooth, export settings for camera and when reach corners with mouse it will move
- Assistant
- User
- Assistant
- User
made me actions list that i need to create
- Assistant
Here is the complete actions list you need to create for your RTS camera functionality. You will need to define these in the Input Map in your Godot project (
Project Settings > Input Map).
Actions List
1. Movement Actions
These actions are for moving the camera around using
W,A,S, keys. - User
good, i made my actual Camera3D root of camera scene and attach script to it, also i name it RTSCamera , so fix
- Assistant
- User
E 0:00:01:0287 can_instantiate: Cannot instantiate C# script because the associated class could not be found. Script: 'res://Scenes/RTSCamera.tscn::CSharpScript_202hh'. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly (it's case-sensitive). <C++ Error> Method/function failed. Returning: false <C++ Source> modules/mono/csharp_script.cpp:2340 @ can_instantiate()
- Assistant
- User
E 0:00:01:0225 can_instantiate: Cannot instantiate C# script because the associated class could not be found. Script: 'res://Scenes/RTSCamera.tscn::CSharpScript_202hh'. Make sure the script exists and contains a class definition with a name that matches the filename of the script exactly (it's case-sensitive). <C++ Error> Method/function failed. Returning: false <C++ Source> modules/mono/csharp_script.cpp:2340 @ can_instantiate()
- Assistant
- User
goodt , no errors, lets add interpolation adn smooth to our camera, because when we zoom in or zoom out its just feels like its using grid
- Assistant
- User
CS0117: 'Engine' does not contain a definition for 'GetProcessDeltaTime' D:\Godot\Zombie\Scripts\RTSCamera.cs(67,104) CS0117: 'Engine' does not contain a definition for 'GetProcessDeltaTime' D:\Godot\Zombie\Scripts\RTSCamera.cs(68,105)
- Assistant
The errors you're encountering (
Enginedoes not contain a definition forGetProcessDeltaTime) occur because I mistakenly usedEngine.GetProcessDeltaTime()instead of using the delta time value that Godot directly provides in the_Process()method.In Godot C#, you don't need to call a function to get the delta time because it is already passed as a parameter to the
_Process(double delta)method. You can use thedeltaargument directly instead of trying to fetch it from theEngineclass.Let's fix that issue and update the script accordingly.
Corrected Rotation Code
Replace these lines:
if (Input.IsActionPressed("rotate_left")) _targetRotationY -= Mathf.DegToRad(RotationSpeed) * Engine.GetProcessDeltaTime(); if (Input.IsActionPressed("rotate_right")) _targetRotationY += Mathf.DegToRad(RotationSpeed) * Engine.GetProcessDeltaTime();With:
if (Input.IsActionPressed("rotate_left")) _targetRotationY -= Mathf.DegToRad(RotationSpeed) * (float)Engine.GetPhysicsInterpolationFraction(); // Adjusted with respect - User
full code pls
- Assistant
- User
zoom in zoom out stop working
- Assistant
- User
zoom in zoom out still wont work after we add interpolation
- Assistant
- User
nah zoom still wont work
- Assistant
- User
so zoom in zoom out not working
also when i press w it zoom in, but it must just move camera like in rts game you know to north no south and all this stuff, we are making rts camera
- Assistant
- User
w a s d keys works as espected, but zoom in zoom out still wont work, why its work before interpolation and not work now?
- Assistant
- User
still wont work, made it work
- Assistant
- User
its not even print debug input action zoom_in and zoom_out , why not work
- Assistant
- User
yes it was mouse wheel, why it not work? but it work with e and q keys
- Assistant
- User
give me full code and made mouse wheel checks for zoom_in and zoom_out
- Assistant
- User
- Assistant
- User
- Assistant