Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by krivel · Jun 16, 2011 at 04:27 PM · webplayermacapplesafari

3D Object Doesn't Show Up In Safari Web Player

We built a web player of our project and it works great in IE and Firefox on PC and Firefox on Mac but will not run properly in Safari! It loads and the interface we designed comes up but the 3d object doesn't show. Any ideas what could cause this?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image krivel · Jun 28, 2011 at 03:25 PM 0
Share

Any takers on this? As per Unity's suggestion, we've separated our "interface" script and "camera" script but the 3d object still does not load in Safari. Any ideas?

avatar image Eli-Davis · Jun 28, 2011 at 09:25 PM 0
Share

Safari's always sucked for me when it comes to the webplayer.

avatar image krivel · Jun 30, 2011 at 06:44 PM 0
Share

I should also note that the initial load in firefox on mac does the same thing...no 3d object. But reloading it works fine. But still nothing in Safari. $$anonymous$$ust be a bug no?

avatar image Eli-Davis · Jun 30, 2011 at 11:48 PM 0
Share

Sounds like it

4 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by krivel · Jul 12, 2011 at 02:59 PM

Bump...posting the code for our camera. Something in here I'm thinking isn't working. We tried a try-catch scenario and get no errors. Any takers?


//CAMERA SETTINGS var target : Transform; //What to rotate around var interfaceGameObject : GameObject; // 07-05-2011 RMG: New

//Standard Settings

private var camDistance : float = 15.0; //# //17

private var offsetCircleX : float = 0.2; //# private var offsetCircleY : float = 1.0; //#

private var startAngleX : float = 122.5 + 180; //# private var startAngleY : float = 91.9; //#

private var angleMin : float = 45.0; //# private var angleMax : float = 92.0; //#

private var angleX : float = 0.0; private var angleY : float = 0.0;

private var xSpeed : float = 45.0; //X sensitivity //# private var ySpeed : float = 45.0; //Y sensitivity //#

private var speedDecay: float = 0.97; //#

private var xMouse : float = 0.0; //X rotation private var yMouse : float = 0.0; //Y rotation

private var xMousePin : float = 0.0; private var yMousePin : float = 0.0;

private var velX : float = 0.0; //X Velocity private var velY : float = 0.0; //Y Velocity

private var useVelocityLimits : boolean = true; private var velXMax : float = 30.0; private var velYMax : float = 30.0;

//HD SETTINGS /* private var camDistance : float = 14.5;

private var offsetCircleX : float = -0.2; private var offsetCircleY : float = 1.25;

private var startAngleX : float = 122.5 + 180; private var startAngleY : float = 91.9;

private var angleMin : float = 45.0; private var angleMax : float = 92.0;

private var angleX : float = 0.0; private var angleY : float = 0.0;

private var xSpeed : float = 45.0; //X sensitivity private var ySpeed : float = 45.0; //Y sensitivity

private var speedDecay: float = 0.98;

private var xMouse : float = 0.0; //X rotation private var yMouse : float = 0.0; //Y rotation

private var xMousePin : float = 0.0; private var yMousePin : float = 0.0;

private var velX : float = 0.0; //X Velocity private var velY : float = 0.0; //Y Velocity

private var useVelocityLimits : boolean = true; private var velXMax : float = 30.0; private var velYMax : float = 30.0; */

private var quarterScreen : float = parseFloat(4)/parseFloat(Screen.width); private var interfaceComponent : Interface = null; // 07-05-2011 RMG: New private var screenAspectRatio : float; // 07-05-2011 RMG: New private var screenRes : Vector2; // 07-05-2011 RMG: Screen resolution at startup

function Start(){

// 07-05-2011 RMG: Save our screen resolution. If this changes, we need to initialize again. screenRes = new Vector2(Screen.width, Screen.height); Initialize();

// 07-05-2011 RMG: If an interface game object exists, find it's Interface component. if (interfaceGameObject != null) { interfaceComponent = interfaceGameObject.GetComponent("Interface"); } //Set Initial Camera Angle angleX = startAngleX; angleY = startAngleY;

UpdateCameraPosition(); }

function LateUpdate() {

var mousePos = Input.mousePosition;

if(Input.GetMouseButtonUp(0)) { //Released mouse button velX = mousePos.x - xMousePin; velY = mousePos.y - yMousePin;

//Check for limits if (useVelocityLimits) { if (velX > velXMax) velX = velXMax;

if (velX < (velXMax -1)) velX = velXMax -1;

if (velY > velYMax) velY = velYMax;

if (velY < (velYMax -1)) velY = velYMax -1; } }

if (Input.GetMouseButtonDown(0)) { //Pushed mouse button xMousePin = mousePos.x; yMousePin = mousePos.y;

// 07-05-2011 RMG: If an interface component exists, call OnMouseClicked. if (interfaceComponent != null) interfaceComponent.OnMouseClicked(Input.mousePosit ion);

} else if(Input.GetMouseButton(0)) { //Mouse button is down xMouse = mousePos.x - xMousePin; yMouse = mousePos.y - yMousePin;

//Check for limits if (useVelocityLimits) { if (xMouse > velXMax) xMouse = velXMax;

if (xMouse < (velXMax -1)) xMouse = velXMax -1;

if (yMouse > velYMax) yMouse = velYMax;

if (yMouse < (velYMax -1)) yMouse = velYMax -1; }

xMousePin = mousePos.x; yMousePin = mousePos.y;

} else { //Handle Velocity xMouse = velX; yMouse = velY;

if (velX != 0.0) velX = velX speedDecay; if (velY != 0.0) velY = velY speedDecay;

if (velX < 0.01 && velX > -0.01) velX = 0.0; if (velY < 0.01 && velY > -0.01) velY = 0.0;

}

UpdateCameraPosition(); }

function Update () { // 07-05-2011 RMG: If screen resolution changes, call Initialize() if (screenRes.x != Screen.width || screenRes.y != Screen.height) { screenRes = new Vector2(Screen.width, Screen.height); Initialize(); } }

function Initialize() { if (Screen.width >= 1200) { camDistance = 14.5; offsetCircleX = -0.2; offsetCircleY = 1.25; speedDecay = 0.98; } else { camDistance = 15.0; offsetCircleX = 0.2; offsetCircleY = 1.0; speedDecay = 0.97; } screenAspectRatio = Screen.width / Screen.height; }

function UpdateCameraPosition(){

var cam = Camera.main; if (cam == null){ print("! Need to tag a camera as Main Camera !"); return; }

angleX += xMouse screenAspectRatio quarterScreen xSpeed; angleY += yMouse screenAspectRatio quarterScreen ySpeed;

//Check angle limits if (angleY < angleMin){ angleY = angleMin; velY = 0; } else if (angleY > angleMax){ angleY = angleMax; velY = 0; } if (angleX > 360){ angleX -= 360; } else if (angleX < 0){ angleX += 360; }

//print(angleX + " : " + angleY);

//Get position around object using polar coordinates var x:float = camDistance Mathf.Cos(Mathf.Deg2Rad angleX) Mathf.Sin(Mathf.Deg2Rad angleY); var y:float = camDistance Mathf.Cos(Mathf.Deg2Rad angleY); var z:float = -camDistance Mathf.Sin(Mathf.Deg2Rad angleX) Mathf.Sin(Mathf.Deg2Rad angleY);

//Offset from target if (target){ x += target.position.x; y += target.position.y; z += target.position.z; }

//Offset ring x += (Mathf.Cos(Mathf.Deg2Rad angleX) offsetCircleX); z += (Mathf.Sin(Mathf.Deg2Rad angleX) offsetCircleY) * -1;

//Position camera; cam.transform.position = Vector3(x, y, z);

//Rotate camera to face object cam.transform.rotation.eulerAngles = Vector3((angleY-90)*-1, angleX-90, 0);

}

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Waz · Jul 12, 2011 at 03:14 PM 0
Share

Editing your answer would suffice. Formatting the code properly would have been ideal.

avatar image krivel · Jul 12, 2011 at 03:16 PM 0
Share

Sorry Warwick..I don't follow.

avatar image Waz · Jul 12, 2011 at 03:29 PM 0
Share

You should not add an answer to bump your question, that makes it look more already-answered. Ins$$anonymous$$d, edit your original question. That bumps it on the Questions list too.

If you meant to comment on my answer,

 private var quarterScreen : float = parseFloat(4)/parseFloat(Screen.width); 

That is wrong.

avatar image krivel · Jul 12, 2011 at 04:36 PM 0
Share

Yeah sorry...did that by mistake..still getting used to the format here. But HUGE thanks for pointing that out. Been driving us nuts!! Its fixed now! I owe you a round some day so maybe at a future Unity event or something :-)

avatar image Waz · Jul 12, 2011 at 09:58 PM 0
Share

I'd be happiest if you could tidy up this Q&A such that others could benefit. I've cleaned up the Answer.

avatar image
0

Answer by Dreamora · Jul 01, 2011 at 02:38 AM

Are you using the page as generated by unity or did you toy with the html? Also is the connection to the server fast enough? (the reload fixes it note on firefox implies that it might not run all as round as it would need to)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by krivel · Jul 01, 2011 at 02:57 AM

No I didn't mess with the html. Connection server is fast. Works flawlessly on IE, firefox and chrome from any pc.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Waz · Jul 12, 2011 at 03:10 PM

Your code relies on the initial value of Screen.width and/or Screen.height:

 private var quarterScreen = 4.0 / Screen.width;
 ...

That is bad, since these change dynamically as the WebPlayer is loaded and resized. You need to track and adapt to changes in these values, or at the very least hard-code in your final assumed size. So:

 function Update()
 {
     quarterScreen = 4.0 / Screen.width;
     ...
 

The reason you see different results in different browsers is that they each resize plugins in their own unspecified ways. Safari's way happens to hit your bug, but that's not Safari's fault.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Mac/Safari Mouse Input Bug? 0 Answers

Different webplayer behaviour on safari on mac 2 Answers

Web player with Mac OSx not open a new window 0 Answers

unity wont appear as installed on mac 0 Answers

Web player performance problem on MAC OS X 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges