Topic: Rotate Camera Script

i used RotateCameraByCompassExample.cs
i add this script to the map GameObject
but it gave me always this error massage :

NullReferenceException: Object reference not set to an instance of an object.
Rotate_Camera.OnCompassChanged (System.Single f) (at Assets/Scripts/Gps_Script/Rotate_Camera.cs:27)
Rotate_Camera.Start () (at Assets/Scripts/Gps_Script/Rotate_Camera.cs:21

Line 21 was:

private void OnCompassChanged(float f)
    {
        // Rotate the camera.
line 21------>       cameraOrbit.rotation.y = f * 360;

should i add any camera on the herarchy "but i cant see any public camera" ?
seem like some thing else !!!!

Re: Rotate Camera Script

Hello.

For this script you need to add the Online Maps Camera Orbit component.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

3 (edited by tamim.ali.zoabi 2019-09-25 22:19:47)

Re: Rotate Camera Script

Ok..

1- i have add this componnent but still give me continues error :
NullReferenceException: Object reference not set to an instance of an object
OnlineMapsCameraOrbit.get_activeCamera () (at Assets/Infinity Code/Online maps/Scripts/Plugins/OnlineMapsCameraOrbit.cs:84)
OnlineMapsCameraOrbit.UpdateCameraPosition () (at Assets/Infinity Code/Online maps/Scripts/Plugins/OnlineMapsCameraOrbit.cs:252)
OnlineMapsCameraOrbit.LateUpdate () (at Assets/Infinity Code/Online maps/Scripts/Plugins/OnlineMapsCameraOrbit.cs:122)



2-  i need to have my  location service Remark to be fixed on the buttom of the map and when my device change location i need to keep my remark fixed in that position and the map moved and rotated .

Re: Rotate Camera Script

i think that error happened because i am using a Texture Control and not a Tile Control
but what can i do now for rotating the map "Texture" if i cant use the Orbit camera .. or is there any other solution for using the orbit camera with the Texture control ?

Re: Rotate Camera Script

Yes, this happens because you are using Texture Control.
Camera Orbit requires Tileset Control.
Why are you using Texture Control?
This Control is present for compatibility and some very specific situations.
And for no serious reason, I do not recommend using this Control.

How to move the marker to the bottom of the screen using Camera Orbit:

float horizontalOffset = 0;
float verticalOffset = 300;

private void OnCameraControl()
{
    Camera activeCamera = OnlineMapsTileSetControl.instance.activeCamera;
    float y = activeCamera.transform.position.y;
    activeCamera.transform.Translate(new Vector3(horizontalOffset, 0, verticalOffset), Space.Self);
    Vector3 p = activeCamera.transform.position;
    activeCamera.transform.position = new Vector3(p.x, y, p.z);
}

private void Start()
{
    OnlineMapsCameraOrbit.instance.OnCameraControl += OnCameraControl;
}

This will work for 2D and for 3D modes.

For other Controls, you need to implement this behavior yourself.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

6 (edited by tamim.ali.zoabi 2019-09-26 11:05:29)

Re: Rotate Camera Script

i used Texture Cause i need this result   "as shown on the attached picture"  .. so i tried to use Tiled but i couldn't got good result "as shown on the attached picture" .. can you help me cause i am 1 step before finishing my App .

if i go and change to Tiled Control now i will be forced to change the hall code :-(
so is there any solution just to make my remark stacked on the buttom and the map go and change as my device change location ?  and i ll Abdicate from rotating the map :-(

Post's attachments

Attachment icon Voicin.jpg 247.06 kb, 58 downloads since 2019-09-26 

Re: Rotate Camera Script

If you still want to use Texture Control, simply rotate the map GameObject along the y axis instead of rotating the camera.
https://docs.unity3d.com/ScriptReferenc … ation.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

Hi 
1- how can i make my remark stacked on the buttom ?
2- how to show the tooltip all the time "no need to pass the mouse over"  ?
3- how to add event " like OnClick" to the tooltip to do any Action ?

Re: Rotate Camera Script

1. This should be done differently:
The marker is located in the center of the map, and the camera adjusts to display the top of the map.
See the screenshot.
2. Online Maps / Advanced / Show Marker Tooltip - Always.
3. By default, tooltips have no action.
To make tooltips have actions you need to implement a custom tooltip engine.
Example:
http://infinity-code.com/atlas/online-m … ample.html
And see the UI Bubble Popup example scene.

Post's attachments

Attachment icon img1.png 582.28 kb, 69 downloads since 2019-09-26 

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

Thanks Done
how to move smoothly between two markers ?

Re: Rotate Camera Script

Example:
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

i used : 2. Online Maps / Advanced / Show Marker Tooltip - Always.
its now doesnt show any tooltip !!!!

Re: Rotate Camera Script

Just checked, and it works correctly.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

maybe because i used:
OnlineMapsGUITooltipDrawer.OnPrepareTooltipStyle += OnPrepareTooltipStyle;     
       
    }
    private void OnPrepareTooltipStyle(ref GUIStyle style)
    {
        // Change the style settings.
        style.fontSize = Screen.width / 10;       
    }
it doesnt show tooltip

Re: Rotate Camera Script

No, this does not affect the display of tooltips.
The problem is something else.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

i cant figure the problem

Re: Rotate Camera Script

Here I don’t know how to help you, because I don’t know how your application works and what components, scripts and settings it uses.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

Ok .. you are right .. I'll check it.
Is there any way to put a seconds counter above the remark  . It a down counter.. when the counter reach to 0 the remark destroyed .
How can I put the counter

Re: Rotate Camera Script

If you mean how to display the counter, you have many ways:
1. Tooltip (label).
2. Custom marker.
3. Position the UI or TextMesh element above the marker.

If you mean how to implement the countdown:

public float duration;
public OnlineMapsMarker marker;
private float progress;

private void Update()
{
  if (marker == null) return;
  progress += Time.deltaTime / duration;
  if (progress > 1)
  {
    OnlineMapsMarkerManager.RemoveItem(marker);
    marker = null;
  }
}

P.S. This code was written not in IDE, and may contain typos.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Rotate Camera Script

I mean how to do step 3
How to know the coordinates of the marker
Is there any converter from vector2 position to coordinate screen

Re: Rotate Camera Script

This example shows how to position UI elements above a marker:
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.