turtleguy955 What's the purpose of the camera in the player scene when you already have a camera in each viewport?
problems with camera orientation
xyz none apparently, but that dosent fix the issue with the orientation in the game scene, now both are fliped like the left one
turtleguy955 Well then rotate both viewport cameras and you're done.
xyz as i stated prior, rotating the viewport cameras does nothing
- Edited
turtleguy955 Have you turned off the ignore_rotation property on those cameras? It's on by default.
xyz yes its disabled on both
turtleguy955 And cameras do not rotate when you adjust their rotation property?
xyz they do not
turtleguy955 Can you post a minimal reproduction project?
xyz yes give me a minute
xyz its done how should i send it to you
turtleguy955 Attach it to a post.
alright here it is
- Edited
turtleguy955 So what exactly is not working here? Everything looks fine. Both cameras rotate in the editor. Your setup creates remote transform nodes that copy each player's transform to corresponding camera's transforms. When you rotate a player, its camera will rotate as well.
xyz The cameras' rotation is offset by 90 degrees in the game window, both icons should have the correct orientation by default. I know It's because the cameras are rotated in the player, but I need them to be so that the driving makes sense in my main project. Changing the code so that the car moves on the Y axis would fix all the problems, but I'm not too sure how to do that.
- Edited
turtleguy955 Well then insert an additional dummy node into hierarchy, parent the camera to it and drive that node with player's transforms. Now the camera is free to be adjusted however you want it. Can even do some tilting/shaking effects.
Don't forget to update the node paths in your setup script so they point to that dummy node instead directly to the cam node.
xyz i might be doing something wrong because it isint working. so i add a node 2d under each subveiwport in the game window, then i re-parent the camera2d to it, then i get the position of the player and give it to the node, then i change the rotation value in the camera2d?
- Edited
- Best Answerset by turtleguy955
turtleguy955 Yes. In your existing script you need to set the camera path to be that dummy node's path:
@onready var players = {
"1" : {
viewport = $HBoxContainer/SubViewportContainer/SubViewport,
camera = $HBoxContainer/SubViewportContainer/SubViewport/Node2D,
player = $HBoxContainer/SubViewportContainer/SubViewport/Map/CharacterBody2D
},
"2" : {
viewport = $HBoxContainer/SubViewportContainer2/SubViewport,
camera = $HBoxContainer/SubViewportContainer2/SubViewport/Node2D,
player = $HBoxContainer/SubViewportContainer/SubViewport/Map/CharacterBody2D2
}
}
Once you get it working, change the name to something more appropriate like camera_rig
xyz this fixed it, thank you very much.