aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorKitto Flora2011-01-04 21:36:09 +0000
committerKitto Flora2011-01-04 21:36:09 +0000
commitba7a2277633804eb2d5e449efa0895e9f43a4ece (patch)
tree950d41b6bed87f6eccf295111b638d3138250993 /OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
parentMerge branch 'master' into careminster-presence-refactor (diff)
downloadopensim-SC_OLD-ba7a2277633804eb2d5e449efa0895e9f43a4ece.zip
opensim-SC_OLD-ba7a2277633804eb2d5e449efa0895e9f43a4ece.tar.gz
opensim-SC_OLD-ba7a2277633804eb2d5e449efa0895e9f43a4ece.tar.bz2
opensim-SC_OLD-ba7a2277633804eb2d5e449efa0895e9f43a4ece.tar.xz
Revise Materials properties; Fix Double-Click Autopilot; Allow non-script sit positions >= 0.1M; Add llLookAt(); Comment out spammy bad adjacent sim message.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs220
1 files changed, 83 insertions, 137 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index e7455be..88f9658 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -264,8 +264,9 @@ namespace OpenSim.Region.Physics.OdePlugin
264 private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>(); 264 private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>();
265 private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>(); 265 private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
266 266
267 private d.Contact contact; 267 private d.Contact ContactCopy; // local copy that can be modified
268 private d.Contact TerrainContact; 268 private d.Contact TerrainContact;
269 private d.Contact AvatarStaticprimContact; // was 'contact'
269 private d.Contact AvatarMovementprimContact; 270 private d.Contact AvatarMovementprimContact;
270 private d.Contact AvatarMovementTerrainContact; 271 private d.Contact AvatarMovementTerrainContact;
271 private d.Contact WaterContact; 272 private d.Contact WaterContact;
@@ -491,169 +492,140 @@ namespace OpenSim.Region.Physics.OdePlugin
491 492
492 staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; 493 staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)];
493 494
494 // Centeral contact friction and bounce // KF: This appears to be only for static AV on non-phys prim. 495 // Avatar static on a Prim parameters
495 contact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 496 AvatarStaticprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
496 contact.surface.mu = 255.0f; 497 AvatarStaticprimContact.surface.mu = 255.0f;
497 contact.surface.bounce = 0.0f; 498 AvatarStaticprimContact.surface.bounce = 0.0f;
498 contact.surface.soft_cfm = 0.0f; 499 AvatarStaticprimContact.surface.soft_cfm = 0.0f;
499 contact.surface.soft_erp = 0.30f; // If this is too small static Av will fall through a sloping prim. 1.0 prevents fall-thru 500 AvatarStaticprimContact.surface.soft_erp = 0.30f; // If this is too small static Av will fall through a sloping prim. 1.0 prevents fall-thru
500
501 // Terrain contact friction and Bounce
502 // This is the *non* moving version. Use this when an avatar
503 // isn't moving to keep it in place better
504/* TerrainContact.surface.mode |= d.ContactFlags.SoftERP;
505 TerrainContact.surface.mu = nmTerrainContactFriction;
506 TerrainContact.surface.bounce = nmTerrainContactBounce;
507 TerrainContact.surface.soft_erp = nmTerrainContactERP; */
508 501
509 TerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 502 // Avatar moving on a Prim parameters
510 TerrainContact.surface.mu = 255.0f;
511 TerrainContact.surface.bounce = 0.0f;
512 TerrainContact.surface.soft_cfm = 0.0f;
513 TerrainContact.surface.soft_erp = 0.05f;
514
515 WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM);
516 WaterContact.surface.mu = 0.0f; // No friction
517 WaterContact.surface.bounce = 0.0f; // No bounce
518 WaterContact.surface.soft_cfm = 0.010f;
519 WaterContact.surface.soft_erp = 0.010f;
520
521 // Prim contact friction and bounce
522 // THis is the moving version of friction and bounce
523 // Use this when an avatar comes in contact with a prim
524 AvatarMovementprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 503 AvatarMovementprimContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
525 AvatarMovementprimContact.surface.mu = 255.0f; 504 AvatarMovementprimContact.surface.mu = 255.0f;
526 AvatarMovementprimContact.surface.bounce = 0.0f; 505 AvatarMovementprimContact.surface.bounce = 0.0f;
527 AvatarMovementprimContact.surface.soft_cfm = 0.0f; // if this is 0.01 then prims become phantom to Avs! 506 AvatarMovementprimContact.surface.soft_cfm = 0.0f; // if this is 0.01 then prims become phantom to Avs!
528 AvatarMovementprimContact.surface.soft_erp = 0.3f; 507 AvatarMovementprimContact.surface.soft_erp = 0.3f;
529 508
530 // Terrain contact friction bounce and various error correcting calculations 509 // Static Avatar on Terrain parameters
531 // Use this when an avatar is in contact with the terrain and moving. 510 // Keeps Avatar in place better
532/* 511 TerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
533 AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP; 512 TerrainContact.surface.mu = 255.0f;
534 AvatarMovementTerrainContact.surface.mu = mTerrainContactFriction; 513 TerrainContact.surface.bounce = 0.0f;
535 AvatarMovementTerrainContact.surface.bounce = mTerrainContactBounce; 514 TerrainContact.surface.soft_cfm = 0.0f;
536 AvatarMovementTerrainContact.surface.soft_erp = mTerrainContactERP; 515 TerrainContact.surface.soft_erp = 0.05f;
537*/ 516
517 // Moving Avatar on Terrain parameters
538 AvatarMovementTerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 518 AvatarMovementTerrainContact.surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
539 AvatarMovementTerrainContact.surface.mu = 75f; 519 AvatarMovementTerrainContact.surface.mu = 75f;
540 AvatarMovementTerrainContact.surface.bounce = 0.0f; 520 AvatarMovementTerrainContact.surface.bounce = 0.0f;
541 AvatarMovementTerrainContact.surface.soft_cfm = 0.0f; 521 AvatarMovementTerrainContact.surface.soft_cfm = 0.0f;
542 AvatarMovementTerrainContact.surface.soft_erp = 0.05f; 522 AvatarMovementTerrainContact.surface.soft_erp = 0.05f;
543 523
544 /* 524 // Avatar or prim the the water, this may not be used, possibly water is same as air?
545 <summary></summary> 525 WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM);
546 Stone = 0, 526 WaterContact.surface.mu = 0.0f; // No friction
547 /// <summary></summary> 527 WaterContact.surface.bounce = 0.0f; // No bounce
548 Metal = 1, 528 WaterContact.surface.soft_cfm = 0.010f;
549 /// <summary></summary> 529 WaterContact.surface.soft_erp = 0.010f;
550 Glass = 2, 530
551 /// <summary></summary>
552 Wood = 3,
553 /// <summary></summary>
554 Flesh = 4,
555 /// <summary></summary>
556 Plastic = 5,
557 /// <summary></summary>
558 Rubber = 6
559 */
560 531
532 // Prim static or moving on a prim, depends on material type
561 m_materialContacts = new d.Contact[7,2]; 533 m_materialContacts = new d.Contact[7,2];
562 // V 1 = Sliding; 0 = static or fell onto 534 // V 1 = Sliding; 0 = static or fell onto
563 m_materialContacts[(int)Material.Stone, 0] = new d.Contact(); 535 m_materialContacts[(int)Material.Stone, 0] = new d.Contact();
564 m_materialContacts[(int)Material.Stone, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 536 m_materialContacts[(int)Material.Stone, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
565 m_materialContacts[(int)Material.Stone, 0].surface.mu = 1.8f; // friction, 1 = slippery, 255 = no slip 537 m_materialContacts[(int)Material.Stone, 0].surface.mu = 60f; // friction, 1 = slippery, 255 = no slip
566 m_materialContacts[(int)Material.Stone, 0].surface.bounce = 0.0f; 538 m_materialContacts[(int)Material.Stone, 0].surface.bounce = 0.0f;
567 m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.0f; 539 m_materialContacts[(int)Material.Stone, 0].surface.soft_cfm = 0.0f;
568 m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.50f; 540 m_materialContacts[(int)Material.Stone, 0].surface.soft_erp = 0.50f; // erp also changes friction, more erp=less friction
569 541
570 m_materialContacts[(int)Material.Stone, 1] = new d.Contact(); 542 m_materialContacts[(int)Material.Stone, 1] = new d.Contact();
571 m_materialContacts[(int)Material.Stone, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 543 m_materialContacts[(int)Material.Stone, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
572 m_materialContacts[(int)Material.Stone, 1].surface.mu = 1.8f; 544 m_materialContacts[(int)Material.Stone, 1].surface.mu = 40f;
573 m_materialContacts[(int)Material.Stone, 1].surface.bounce = 0.0f; 545 m_materialContacts[(int)Material.Stone, 1].surface.bounce = 0.0f;
574 m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.0f; 546 m_materialContacts[(int)Material.Stone, 1].surface.soft_cfm = 0.0f;
575 m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.50f; 547 m_materialContacts[(int)Material.Stone, 1].surface.soft_erp = 0.50f;
576 548
577 m_materialContacts[(int)Material.Metal, 0] = new d.Contact(); 549 m_materialContacts[(int)Material.Metal, 0] = new d.Contact();
578 m_materialContacts[(int)Material.Metal, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 550 m_materialContacts[(int)Material.Metal, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
579 m_materialContacts[(int)Material.Metal, 0].surface.mu = 1.3f; 551 m_materialContacts[(int)Material.Metal, 0].surface.mu = 15f;
580 m_materialContacts[(int)Material.Metal, 0].surface.bounce = 0.2f; 552 m_materialContacts[(int)Material.Metal, 0].surface.bounce = 0.2f;
581 m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.0f; 553 m_materialContacts[(int)Material.Metal, 0].surface.soft_cfm = 0.0f;
582 m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.50f; 554 m_materialContacts[(int)Material.Metal, 0].surface.soft_erp = 0.50f;
583 555
584 m_materialContacts[(int)Material.Metal, 1] = new d.Contact(); 556 m_materialContacts[(int)Material.Metal, 1] = new d.Contact();
585 m_materialContacts[(int)Material.Metal, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 557 m_materialContacts[(int)Material.Metal, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
586 m_materialContacts[(int)Material.Metal, 1].surface.mu = 1.3f; 558 m_materialContacts[(int)Material.Metal, 1].surface.mu = 10f;
587 m_materialContacts[(int)Material.Metal, 1].surface.bounce = 0.2f; 559 m_materialContacts[(int)Material.Metal, 1].surface.bounce = 0.2f;
588 m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.0f; 560 m_materialContacts[(int)Material.Metal, 1].surface.soft_cfm = 0.0f;
589 m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.50f; 561 m_materialContacts[(int)Material.Metal, 1].surface.soft_erp = 0.50f;
590 562
591 m_materialContacts[(int)Material.Glass, 0] = new d.Contact(); 563 m_materialContacts[(int)Material.Glass, 0] = new d.Contact();
592 m_materialContacts[(int)Material.Glass, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 564 m_materialContacts[(int)Material.Glass, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
593 m_materialContacts[(int)Material.Glass, 0].surface.mu = 1f; 565 m_materialContacts[(int)Material.Glass, 0].surface.mu = 7.5f;
594 m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.0f; 566 m_materialContacts[(int)Material.Glass, 0].surface.bounce = 0.0f;
595 m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.01f; 567 m_materialContacts[(int)Material.Glass, 0].surface.soft_cfm = 0.0f;
596 m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.50f; 568 m_materialContacts[(int)Material.Glass, 0].surface.soft_erp = 0.50f;
597 569
598 m_materialContacts[(int)Material.Glass, 1] = new d.Contact(); 570 m_materialContacts[(int)Material.Glass, 1] = new d.Contact();
599 m_materialContacts[(int)Material.Glass, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 571 m_materialContacts[(int)Material.Glass, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
600 m_materialContacts[(int)Material.Glass, 1].surface.mu = 1f; 572 m_materialContacts[(int)Material.Glass, 1].surface.mu = 5f;
601 m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.0f; 573 m_materialContacts[(int)Material.Glass, 1].surface.bounce = 0.0f;
602 m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.0f; 574 m_materialContacts[(int)Material.Glass, 1].surface.soft_cfm = 0.0f;
603 m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.30f; 575 m_materialContacts[(int)Material.Glass, 1].surface.soft_erp = 0.50f;
604 576
605 m_materialContacts[(int)Material.Wood, 0] = new d.Contact(); 577 m_materialContacts[(int)Material.Wood, 0] = new d.Contact();
606 m_materialContacts[(int)Material.Wood, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 578 m_materialContacts[(int)Material.Wood, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
607 m_materialContacts[(int)Material.Wood, 0].surface.mu = 1.6f; 579 m_materialContacts[(int)Material.Wood, 0].surface.mu = 45f;
608 m_materialContacts[(int)Material.Wood, 0].surface.bounce = 0.1f; 580 m_materialContacts[(int)Material.Wood, 0].surface.bounce = 0.1f;
609 m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.0f; 581 m_materialContacts[(int)Material.Wood, 0].surface.soft_cfm = 0.0f;
610 m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.50f; 582 m_materialContacts[(int)Material.Wood, 0].surface.soft_erp = 0.50f;
611 583
612 m_materialContacts[(int)Material.Wood, 1] = new d.Contact(); 584 m_materialContacts[(int)Material.Wood, 1] = new d.Contact();
613 m_materialContacts[(int)Material.Wood, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 585 m_materialContacts[(int)Material.Wood, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
614 m_materialContacts[(int)Material.Wood, 1].surface.mu = 1.6f; 586 m_materialContacts[(int)Material.Wood, 1].surface.mu = 30f;
615 m_materialContacts[(int)Material.Wood, 1].surface.bounce = 0.1f; 587 m_materialContacts[(int)Material.Wood, 1].surface.bounce = 0.1f;
616 m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.0f; 588 m_materialContacts[(int)Material.Wood, 1].surface.soft_cfm = 0.0f;
617 m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.50f; 589 m_materialContacts[(int)Material.Wood, 1].surface.soft_erp = 0.50f;
618 590
619 m_materialContacts[(int)Material.Flesh, 0] = new d.Contact(); 591 m_materialContacts[(int)Material.Flesh, 0] = new d.Contact();
620 m_materialContacts[(int)Material.Flesh, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 592 m_materialContacts[(int)Material.Flesh, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
621 m_materialContacts[(int)Material.Flesh, 0].surface.mu = 2.0f; 593 m_materialContacts[(int)Material.Flesh, 0].surface.mu = 150f;
622 m_materialContacts[(int)Material.Flesh, 0].surface.bounce = 0.0f; 594 m_materialContacts[(int)Material.Flesh, 0].surface.bounce = 0.0f;
623 m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.0f; 595 m_materialContacts[(int)Material.Flesh, 0].surface.soft_cfm = 0.0f;
624 m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.50f; 596 m_materialContacts[(int)Material.Flesh, 0].surface.soft_erp = 0.50f;
625 597
626 m_materialContacts[(int)Material.Flesh, 1] = new d.Contact(); 598 m_materialContacts[(int)Material.Flesh, 1] = new d.Contact();
627 m_materialContacts[(int)Material.Flesh, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 599 m_materialContacts[(int)Material.Flesh, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
628 m_materialContacts[(int)Material.Flesh, 1].surface.mu = 2.0f; 600 m_materialContacts[(int)Material.Flesh, 1].surface.mu = 100f;
629 m_materialContacts[(int)Material.Flesh, 1].surface.bounce = 0.0f; 601 m_materialContacts[(int)Material.Flesh, 1].surface.bounce = 0.0f;
630 m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.0f; 602 m_materialContacts[(int)Material.Flesh, 1].surface.soft_cfm = 0.0f;
631 m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.50f; 603 m_materialContacts[(int)Material.Flesh, 1].surface.soft_erp = 0.50f;
632 604
633 m_materialContacts[(int)Material.Plastic, 0] = new d.Contact(); 605 m_materialContacts[(int)Material.Plastic, 0] = new d.Contact();
634 m_materialContacts[(int)Material.Plastic, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 606 m_materialContacts[(int)Material.Plastic, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
635 m_materialContacts[(int)Material.Plastic, 0].surface.mu = 1.5f; 607 m_materialContacts[(int)Material.Plastic, 0].surface.mu = 30f;
636 m_materialContacts[(int)Material.Plastic, 0].surface.bounce = 0.2f; 608 m_materialContacts[(int)Material.Plastic, 0].surface.bounce = 0.2f;
637 m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.0f; 609 m_materialContacts[(int)Material.Plastic, 0].surface.soft_cfm = 0.0f;
638 m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.50f; 610 m_materialContacts[(int)Material.Plastic, 0].surface.soft_erp = 0.50f;
639 611
640 m_materialContacts[(int)Material.Plastic, 1] = new d.Contact(); 612 m_materialContacts[(int)Material.Plastic, 1] = new d.Contact();
641 m_materialContacts[(int)Material.Plastic, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 613 m_materialContacts[(int)Material.Plastic, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
642 m_materialContacts[(int)Material.Plastic, 1].surface.mu = 1.5f; 614 m_materialContacts[(int)Material.Plastic, 1].surface.mu = 20f;
643 m_materialContacts[(int)Material.Plastic, 1].surface.bounce = 0.2f; 615 m_materialContacts[(int)Material.Plastic, 1].surface.bounce = 0.2f;
644 m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.0f; 616 m_materialContacts[(int)Material.Plastic, 1].surface.soft_cfm = 0.0f;
645 m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.50f; 617 m_materialContacts[(int)Material.Plastic, 1].surface.soft_erp = 0.50f;
646 618
647 m_materialContacts[(int)Material.Rubber, 0] = new d.Contact(); 619 m_materialContacts[(int)Material.Rubber, 0] = new d.Contact();
648 m_materialContacts[(int)Material.Rubber, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 620 m_materialContacts[(int)Material.Rubber, 0].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
649 m_materialContacts[(int)Material.Rubber, 0].surface.mu = 2.0f; 621 m_materialContacts[(int)Material.Rubber, 0].surface.mu = 150f;
650 m_materialContacts[(int)Material.Rubber, 0].surface.bounce = 0.7f; 622 m_materialContacts[(int)Material.Rubber, 0].surface.bounce = 0.7f;
651 m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.0f; 623 m_materialContacts[(int)Material.Rubber, 0].surface.soft_cfm = 0.0f;
652 m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.50f; 624 m_materialContacts[(int)Material.Rubber, 0].surface.soft_erp = 0.50f;
653 625
654 m_materialContacts[(int)Material.Rubber, 1] = new d.Contact(); 626 m_materialContacts[(int)Material.Rubber, 1] = new d.Contact();
655 m_materialContacts[(int)Material.Rubber, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce; 627 m_materialContacts[(int)Material.Rubber, 1].surface.mode = d.ContactFlags.SoftCFM | d.ContactFlags.SoftERP | d.ContactFlags.Bounce;
656 m_materialContacts[(int)Material.Rubber, 1].surface.mu = 2.0f; 628 m_materialContacts[(int)Material.Rubber, 1].surface.mu = 100f;
657 m_materialContacts[(int)Material.Rubber, 1].surface.bounce = 0.7f; 629 m_materialContacts[(int)Material.Rubber, 1].surface.bounce = 0.7f;
658 m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.0f; 630 m_materialContacts[(int)Material.Rubber, 1].surface.soft_cfm = 0.0f;
659 m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.50f; 631 m_materialContacts[(int)Material.Rubber, 1].surface.soft_erp = 0.50f;
@@ -819,11 +791,6 @@ namespace OpenSim.Region.Physics.OdePlugin
819 p2 = PANull; 791 p2 = PANull;
820 } 792 }
821 793
822if((p1 is OdePrim ) && (p2 is OdePrim)){
823 OdePrim t1 = (OdePrim)p1;
824 OdePrim t2 = (OdePrim)p2;
825 Console.WriteLine("Collision {0} {1}", t1.m_primName, t2.m_primName);
826}
827 ContactPoint maxDepthContact = new ContactPoint(); 794 ContactPoint maxDepthContact = new ContactPoint();
828 if (p1.CollisionScore + count >= float.MaxValue) 795 if (p1.CollisionScore + count >= float.MaxValue)
829 p1.CollisionScore = 0; 796 p1.CollisionScore = 0;
@@ -847,7 +814,7 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
847 814
848 //m_log.Warn("[CCOUNT]: " + count); 815 //m_log.Warn("[CCOUNT]: " + count);
849 IntPtr joint; 816 IntPtr joint;
850 // If we're colliding with terrain, use 'TerrainContact' instead of contact. 817 // If we're colliding with terrain, use 'TerrainContact' instead of AvatarStaticprimContact.
851 // allows us to have different settings 818 // allows us to have different settings
852 819
853 // We only need to test p2 for 'jump crouch purposes' 820 // We only need to test p2 for 'jump crouch purposes'
@@ -898,9 +865,9 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
898 //This is disabled at the moment only because it needs more tweaking 865 //This is disabled at the moment only because it needs more tweaking
899 //It will eventually be uncommented 866 //It will eventually be uncommented
900 /* 867 /*
901 if (contact.depth >= 1.00f) 868 if (AvatarStaticprimContact.depth >= 1.00f)
902 { 869 {
903 //m_log.Debug("[PHYSICS]: " + contact.depth.ToString()); 870 //m_log.Debug("[PHYSICS]: " + AvatarStaticprimContact.depth.ToString());
904 } 871 }
905 872
906 //If you interpenetrate a prim with an agent 873 //If you interpenetrate a prim with an agent
@@ -910,37 +877,37 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
910 p2.PhysicsActorType == (int) ActorTypes.Prim)) 877 p2.PhysicsActorType == (int) ActorTypes.Prim))
911 { 878 {
912 879
913 //contact.depth = contact.depth * 4.15f; 880 //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth * 4.15f;
914 /* 881 /*
915 if (p2.PhysicsActorType == (int) ActorTypes.Agent) 882 if (p2.PhysicsActorType == (int) ActorTypes.Agent)
916 { 883 {
917 p2.CollidingObj = true; 884 p2.CollidingObj = true;
918 contact.depth = 0.003f; 885 AvatarStaticprimContact.depth = 0.003f;
919 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); 886 p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f);
920 OdeCharacter character = (OdeCharacter) p2; 887 OdeCharacter character = (OdeCharacter) p2;
921 character.SetPidStatus(true); 888 character.SetPidStatus(true);
922 contact.pos = new d.Vector3(contact.pos.X + (p1.Size.X / 2), contact.pos.Y + (p1.Size.Y / 2), contact.pos.Z + (p1.Size.Z / 2)); 889 AvatarStaticprimContact.pos = new d.Vector3(AvatarStaticprimContact.pos.X + (p1.Size.X / 2), AvatarStaticprimContact.pos.Y + (p1.Size.Y / 2), AvatarStaticprimContact.pos.Z + (p1.Size.Z / 2));
923 890
924 } 891 }
925 else 892 else
926 { 893 {
927 894
928 //contact.depth = 0.0000000f; 895 //AvatarStaticprimContact.depth = 0.0000000f;
929 } 896 }
930 if (p1.PhysicsActorType == (int) ActorTypes.Agent) 897 if (p1.PhysicsActorType == (int) ActorTypes.Agent)
931 { 898 {
932 899
933 p1.CollidingObj = true; 900 p1.CollidingObj = true;
934 contact.depth = 0.003f; 901 AvatarStaticprimContact.depth = 0.003f;
935 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); 902 p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f);
936 contact.pos = new d.Vector3(contact.pos.X + (p2.Size.X / 2), contact.pos.Y + (p2.Size.Y / 2), contact.pos.Z + (p2.Size.Z / 2)); 903 AvatarStaticprimContact.pos = new d.Vector3(AvatarStaticprimContact.pos.X + (p2.Size.X / 2), AvatarStaticprimContact.pos.Y + (p2.Size.Y / 2), AvatarStaticprimContact.pos.Z + (p2.Size.Z / 2));
937 OdeCharacter character = (OdeCharacter)p1; 904 OdeCharacter character = (OdeCharacter)p1;
938 character.SetPidStatus(true); 905 character.SetPidStatus(true);
939 } 906 }
940 else 907 else
941 { 908 {
942 909
943 //contact.depth = 0.0000000f; 910 //AvatarStaticprimContact.depth = 0.0000000f;
944 } 911 }
945 912
946 913
@@ -965,7 +932,7 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
965 //AddPhysicsActorTaint(p2); 932 //AddPhysicsActorTaint(p2);
966 //} 933 //}
967 934
968 //if (contact.depth >= 0.25f) 935 //if (AvatarStaticprimContact.depth >= 0.25f)
969 //{ 936 //{
970 // Don't collide, one or both prim will expld. 937 // Don't collide, one or both prim will expld.
971 938
@@ -983,13 +950,13 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
983 //AddPhysicsActorTaint(p2); 950 //AddPhysicsActorTaint(p2);
984 //} 951 //}
985 952
986 //contact.depth = contact.depth / 8f; 953 //AvatarStaticprimContact.depth = AvatarStaticprimContact.depth / 8f;
987 //contact.normal = new d.Vector3(0, 0, 1); 954 //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1);
988 //} 955 //}
989 //if (op1.m_disabled || op2.m_disabled) 956 //if (op1.m_disabled || op2.m_disabled)
990 //{ 957 //{
991 //Manually disabled objects stay disabled 958 //Manually disabled objects stay disabled
992 //contact.depth = 0f; 959 //AvatarStaticprimContact.depth = 0f;
993 //} 960 //}
994 #endregion 961 #endregion
995 } 962 }
@@ -997,7 +964,7 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
997#endregion 964#endregion
998 if (curContact.depth >= 1.00f) 965 if (curContact.depth >= 1.00f)
999 { 966 {
1000 //m_log.Info("[P]: " + contact.depth.ToString()); 967 //m_log.Info("[P]: " + AvatarStaticprimContact.depth.ToString());
1001 if ((p2.PhysicsActorType == (int) ActorTypes.Agent && 968 if ((p2.PhysicsActorType == (int) ActorTypes.Agent &&
1002 p1.PhysicsActorType == (int) ActorTypes.Unknown) || 969 p1.PhysicsActorType == (int) ActorTypes.Unknown) ||
1003 (p1.PhysicsActorType == (int) ActorTypes.Agent && 970 (p1.PhysicsActorType == (int) ActorTypes.Agent &&
@@ -1067,15 +1034,16 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1067 if (!skipThisContact) 1034 if (!skipThisContact)
1068 { 1035 {
1069 // Add contact joints with materials params---------------------------------- 1036 // Add contact joints with materials params----------------------------------
1037 // p1 is what is being hit, p2 is the physical object doing the hitting
1070 int material = (int) Material.Wood; 1038 int material = (int) Material.Wood;
1071 int movintYN = 0; // 1 = Sliding; 0 = static or fell onto 1039 int movintYN = 0; // 1 = Sliding; 0 = static or fell onto
1040 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f) movintYN = 1;
1072 1041
1073 // If we're colliding against terrain 1042 // If we're colliding against terrain
1074 if (name1 == "Terrain" || name2 == "Terrain") 1043 if (name1 == "Terrain" || name2 == "Terrain")
1075 { 1044 {
1076 // If we're moving 1045 // If we're moving
1077 if ((p2.PhysicsActorType == (int) ActorTypes.Agent) && 1046 if ((p2.PhysicsActorType == (int) ActorTypes.Agent) && (movintYN == 1))
1078 (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f))
1079 { 1047 {
1080 //$ Av walk/run on terrain (not falling) Use the Avatar movement terrain contact 1048 //$ Av walk/run on terrain (not falling) Use the Avatar movement terrain contact
1081 AvatarMovementTerrainContact.geom = curContact; 1049 AvatarMovementTerrainContact.geom = curContact;
@@ -1103,13 +1071,9 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1103 { 1071 {
1104 if (p2.PhysicsActorType == (int)ActorTypes.Prim && p1.PhysicsActorType == (int)ActorTypes.Prim) 1072 if (p2.PhysicsActorType == (int)ActorTypes.Prim && p1.PhysicsActorType == (int)ActorTypes.Prim)
1105 { 1073 {
1106 //& THIS NEVER HAPPENS prim prim contact //kf Huh? In terrain contact? 1074 //& THIS NEVER HAPPENS? prim prim contact In terrain contact?
1107 // int pj294950 = 0; 1075 // int pj294950 = 0;
1108 // prim terrain contact 1076 // prim terrain contact
1109 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
1110 {
1111 movintYN = 1;
1112 }
1113 1077
1114 if (p2 is OdePrim) 1078 if (p2 is OdePrim)
1115 material = ((OdePrim)p2).m_material; 1079 material = ((OdePrim)p2).m_material;
@@ -1128,34 +1092,31 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1128 else 1092 else
1129 { 1093 {
1130 //$ prim on terrain contact 1094 //$ prim on terrain contact
1131 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
1132 {
1133 movintYN = 1;
1134 }
1135
1136 if (p2 is OdePrim) 1095 if (p2 is OdePrim)
1137 material = ((OdePrim)p2).m_material; 1096 material = ((OdePrim)p2).m_material;
1138 //m_log.DebugFormat("Material: {0}", material); 1097 //m_log.DebugFormat("Material: {0}", material);
1139 m_materialContacts[material, movintYN].geom = curContact; 1098 m_materialContacts[material, movintYN].geom = curContact;
1140 _perloopContact.Add(curContact); 1099 _perloopContact.Add(curContact);
1141 1100
1101 ContactCopy = m_materialContacts[material, movintYN];
1102 if(movintYN == 1)
1103 {
1104 // prevent excessive slide on terrain
1105 ContactCopy.surface.mu = m_materialContacts[material, movintYN].surface.mu * 30.0f;
1106 }
1107
1142 if (m_global_contactcount < maxContactsbeforedeath) 1108 if (m_global_contactcount < maxContactsbeforedeath)
1143 { 1109 {
1144 joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]); 1110 joint = d.JointCreateContact(world, contactgroup, ref ContactCopy);
1145 m_global_contactcount++; 1111 m_global_contactcount++;
1146
1147 } 1112 }
1148 } 1113 }
1149 } 1114 }
1150 } 1115 }
1151 //if (p2.PhysicsActorType == (int)ActorTypes.Prim)
1152 //{
1153 //m_log.Debug("[PHYSICS]: prim contacting with ground");
1154 //}
1155 } 1116 }
1156 else if (name1 == "Water" || name2 == "Water") 1117 else if (name1 == "Water" || name2 == "Water")
1157 { 1118 {
1158 //$ This never happens! 1119 //$ This never happens! Perhaps water is treated like air?
1159 /* 1120 /*
1160 if ((p2.PhysicsActorType == (int) ActorTypes.Prim)) 1121 if ((p2.PhysicsActorType == (int) ActorTypes.Prim))
1161 { 1122 {
@@ -1169,8 +1130,8 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1169 if (curContact.depth > 0.1f) 1130 if (curContact.depth > 0.1f)
1170 { 1131 {
1171 curContact.depth *= 52; 1132 curContact.depth *= 52;
1172 //contact.normal = new d.Vector3(0, 0, 1); 1133 //AvatarStaticprimContact.normal = new d.Vector3(0, 0, 1);
1173 //contact.pos = new d.Vector3(0, 0, contact.pos.Z - 5f); 1134 //AvatarStaticprimContact.pos = new d.Vector3(0, 0, contact.pos.Z - 5f);
1174 } 1135 }
1175 WaterContact.geom = curContact; 1136 WaterContact.geom = curContact;
1176 _perloopContact.Add(curContact); 1137 _perloopContact.Add(curContact);
@@ -1179,7 +1140,7 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1179 joint = d.JointCreateContact(world, contactgroup, ref WaterContact); 1140 joint = d.JointCreateContact(world, contactgroup, ref WaterContact);
1180 m_global_contactcount++; 1141 m_global_contactcount++;
1181 } 1142 }
1182 //m_log.Info("[PHYSICS]: Prim Water Contact" + contact.depth); 1143 //m_log.Info("[PHYSICS]: Prim Water Contact" + AvatarStaticprimContact.depth);
1183 } 1144 }
1184 else 1145 else
1185 { 1146 {
@@ -1189,7 +1150,7 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1189 if ((p2.PhysicsActorType == (int)ActorTypes.Agent)) 1150 if ((p2.PhysicsActorType == (int)ActorTypes.Agent))
1190 { 1151 {
1191 //$ Avatar on Prim or other Avatar 1152 //$ Avatar on Prim or other Avatar
1192 if ((Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) 1153 if (movintYN == 1)
1193 { 1154 {
1194 // Use the AV Movement / prim contact 1155 // Use the AV Movement / prim contact
1195 AvatarMovementprimContact.geom = curContact; 1156 AvatarMovementprimContact.geom = curContact;
@@ -1203,34 +1164,24 @@ if((p1 is OdePrim ) && (p2 is OdePrim)){
1203 else 1164 else
1204 { 1165 {
1205 // Use the Av non movement / prim contact 1166 // Use the Av non movement / prim contact
1206 contact.geom = curContact; 1167 AvatarStaticprimContact.geom = curContact;
1207 _perloopContact.Add(curContact); 1168 _perloopContact.Add(curContact);
1169 ContactCopy = AvatarStaticprimContact; // local copy so we can change locally
1208 1170
1209 if (m_global_contactcount < maxContactsbeforedeath) 1171 if (m_global_contactcount < maxContactsbeforedeath)
1210 { 1172 {
1211 if (curContact.depth > 0.2) 1173 if (curContact.depth > 0.2)
1212 { // embedded, eject slowly 1174 { // embedded, eject slowly
1213 contact.surface.soft_erp = 0.1f; 1175 ContactCopy.surface.soft_erp = 0.1f;
1214 contact.surface.soft_cfm = 0.1f; 1176 ContactCopy.surface.soft_cfm = 0.1f;
1215 } 1177 }
1216 else 1178 else
1217 { // keep on the surface 1179 { // keep on the surface
1218 contact.surface.soft_erp = 0.3f; 1180 ContactCopy.surface.soft_erp = 0.3f;
1219 contact.surface.soft_cfm = 0.0f; 1181 ContactCopy.surface.soft_cfm = 0.0f;
1220 } 1182 }
1221 joint = d.JointCreateContact(world, contactgroup, ref contact); 1183 joint = d.JointCreateContact(world, contactgroup, ref ContactCopy);
1222 m_global_contactcount++; 1184 m_global_contactcount++;
1223/*
1224Console.WriteLine("Prim | Av collision 2 mode={0} mu={1} bounce={2} bv={3} erp={4} cfm={5} mot={6} depth={7}",
1225contact.surface.mode,
1226contact.surface.mu,
1227contact.surface.bounce,
1228contact.surface.bounce_vel,
1229contact.surface.soft_erp,
1230contact.surface.soft_cfm,
1231contact.surface.motion1,
1232curContact.depth);
1233*/
1234 } 1185 }
1235 } 1186 }
1236 } 1187 }
@@ -1241,16 +1192,11 @@ curContact.depth);
1241 1192
1242 if (p2 is OdePrim) material = ((OdePrim)p2).m_material; 1193 if (p2 is OdePrim) material = ((OdePrim)p2).m_material;
1243 //m_log.DebugFormat("Material: {0}", material); 1194 //m_log.DebugFormat("Material: {0}", material);
1244
1245 if (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)
1246 {
1247 movintYN = 1;
1248 }
1249 1195
1250 m_materialContacts[material, movintYN].geom = curContact; 1196 m_materialContacts[material, movintYN].geom = curContact;
1251 _perloopContact.Add(curContact); 1197 _perloopContact.Add(curContact);
1252 1198
1253 if (m_global_contactcount < maxContactsbeforedeath) 1199 if (m_global_contactcount < maxContactsbeforedeath)
1254 { 1200 {
1255 joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]); 1201 joint = d.JointCreateContact(world, contactgroup, ref m_materialContacts[material, movintYN]);
1256 m_global_contactcount++; 1202 m_global_contactcount++;